1/*! addEventListener Polyfill ie9- http://stackoverflow.com/a/27790212*/ 2window.addEventListener = window.addEventListener || function (e, f) { window.attachEvent('on' + e, f); }; 3 4 5/*! Datenow Polyfill ie9- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now */ 6if (!Date.now) { 7 Date.now = function now() { 8 return new Date().getTime(); 9 }; 10} 11 12 13/*! Object.create monkey patch ie8 http://stackoverflow.com/a/18020326 */ 14if ( ! Object.create ) { 15 Object.create = function(proto, props) { 16 if (typeof props !== "undefined") { 17 throw "The multiple-argument version of Object.create is not provided by this browser and cannot be shimmed."; 18 } 19 function ctor() { } 20 21 ctor.prototype = proto; 22 return new ctor(); 23 }; 24} 25 26 27/*! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter */ 28if ( ! Array.prototype.filter ) { 29 Array.prototype.filter = function(fun/*, thisArg*/) { 30 'use strict'; 31 32 if (this === void 0 || this === null) { 33 throw new TypeError(); 34 } 35 36 var t = Object(this); 37 var len = t.length >>> 0; 38 if (typeof fun !== 'function') { 39 throw new TypeError(); 40 } 41 42 var res = []; 43 var thisArg = arguments.length >= 2 ? arguments[1] : void 0; 44 for (var i = 0; i < len; i++) { 45 if (i in t) { 46 var val = t[i]; 47 if (fun.call(thisArg, val, i, t)) { 48 res.push(val); 49 } 50 } 51 } 52 53 return res; 54 }; 55} 56 57 58 59/*! map was added to the ECMA-262 standard in the 5th edition */ 60if (!Array.prototype.map) { 61 62 Array.prototype.map = function(callback, thisArg) { 63 64 var T, A, k; 65 66 if (this === null) { 67 throw new TypeError(' this is null or not defined'); 68 } 69 var O = Object(this); 70 var len = O.length >>> 0; 71 if (typeof callback !== 'function') { 72 throw new TypeError(callback + ' is not a function'); 73 } 74 if (arguments.length > 1) { 75 T = thisArg; 76 } 77 A = new Array(len); 78 k = 0; 79 while (k < len) { 80 81 var kValue, mappedValue; 82 if (k in O) { 83 kValue = O[k]; 84 mappedValue = callback.call(T, kValue, k, O); 85 A[k] = mappedValue; 86 } 87 k++; 88 } 89 return A; 90 }; 91} 92/*! Array.from was added to the ECMA-262 standard in the 6th edition (ES2015) */ 93if (!Array.from) { 94 Array.from = (function () { 95 var toStr = Object.prototype.toString; 96 var isCallable = function (fn) { 97 return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; 98 }; 99 var toInteger = function (value) { 100 var number = Number(value); 101 if (isNaN(number)) { return 0; } 102 if (number === 0 || !isFinite(number)) { return number; } 103 return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number)); 104 }; 105 var maxSafeInteger = Math.pow(2, 53) - 1; 106 var toLength = function (value) { 107 var len = toInteger(value); 108 return Math.min(Math.max(len, 0), maxSafeInteger); 109 }; 110 return function from(arrayLike/*, mapFn, thisArg */) { 111 var C = this; 112 var items = Object(arrayLike); 113 if (arrayLike == null) { 114 throw new TypeError('Array.from requires an array-like object - not null or undefined'); 115 } 116 var mapFn = arguments.length > 1 ? arguments[1] : void undefined; 117 var T; 118 if (typeof mapFn !== 'undefined') { 119 if (!isCallable(mapFn)) { 120 throw new TypeError('Array.from: when provided, the second argument must be a function'); 121 } 122 if (arguments.length > 2) { 123 T = arguments[2]; 124 } 125 } 126 var len = toLength(items.length); 127 var A = isCallable(C) ? Object(new C(len)) : new Array(len); 128 var k = 0; 129 var kValue; 130 while (k < len) { 131 kValue = items[k]; 132 if (mapFn) { 133 A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k); 134 } else { 135 A[k] = kValue; 136 } 137 k += 1; 138 } 139 A.length = len; 140 return A; 141 }; 142 }()); 143} 144(function ( $ ) { 145 146 var pluginPrefix = 'original', 147 _props = ['Width', 'Height']; 148 149 _props.map( function(_prop) { 150 var _lprop = _prop.toLowerCase(); 151 $.fn[ pluginPrefix + _prop ] = ('natural' + _prop in new Image()) ? 152 function () { 153 return this[0][ 'natural' + _prop ]; 154 } : 155 function () { 156 var _size = _getAttr( this, _lprop ); 157 158 if ( _size ) 159 return _size; 160 161 var _node = this[0], 162 _img; 163 164 if (_node.tagName.toLowerCase() === 'img') { 165 _img = new Image(); 166 _img.src = _node.src; 167 _size = _img[ _lprop ]; 168 } 169 return _size; 170 }; 171 } );//map() 172 173 function _getAttr( _el, prop ){ 174 var _img_size = $(_el).attr( prop ); 175 return ( typeof _img_size === undefined ) ? false : _img_size; 176 } 177 178})( jQuery ); 179(function ( $, window ) { 180 var pluginName = 'imgSmartLoad', 181 defaults = { 182 load_all_images_on_first_scroll : false, 183 attribute : [ 'data-src', 'data-srcset', 'data-sizes' ], 184 excludeImg : [], 185 threshold : 200, 186 fadeIn_options : { duration : 400 }, 187 delaySmartLoadEvent : 0, 188 189 }, 190 skipImgClass = 'tc-smart-load-skip'; 191 192 193 function Plugin( element, options ) { 194 this.element = element; 195 this.options = $.extend( {}, defaults, options) ; 196 if ( _.isArray( this.options.excludeImg ) ) { 197 this.options.excludeImg.push( '.'+skipImgClass ); 198 } else { 199 this.options.excludeImg = [ '.'+skipImgClass ]; 200 } 201 202 this._defaults = defaults; 203 this._name = pluginName; 204 this.init(); 205 } 206 Plugin.prototype.init = function () { 207 var self = this, 208 $_imgs = $( 'img[' + this.options.attribute[0] + ']:not('+ this.options.excludeImg.join() +')' , this.element ); 209 210 this.increment = 1;//used to wait a little bit after the first user scroll actions to trigger the timer 211 this.timer = 0; 212 213 214 $_imgs 215 .addClass( skipImgClass ) 216 .bind( 'load_img', {}, function() { 217 self._load_img(this); 218 }); 219 $(window).scroll( function( _evt ) { self._better_scroll_event_handler( $_imgs, _evt ); } ); 220 $(window).resize( _.debounce( function( _evt ) { self._maybe_trigger_load( $_imgs, _evt ); }, 100 ) ); 221 this._maybe_trigger_load( $_imgs ); 222 }; 223 Plugin.prototype._better_scroll_event_handler = function( $_imgs , _evt ) { 224 var self = this; 225 if ( ! this.doingAnimation ) { 226 this.doingAnimation = true; 227 window.requestAnimationFrame(function() { 228 self._maybe_trigger_load( $_imgs , _evt ); 229 self.doingAnimation = false; 230 }); 231 } 232 }; 233 Plugin.prototype._maybe_trigger_load = function( $_imgs , _evt ) { 234 var self = this, 235 _visible_list = $_imgs.filter( function( ind, _img ) { return self._is_visible( _img , _evt ); } ); 236 _visible_list.map( function( ind, _img ) { 237 $(_img).trigger( 'load_img' ); 238 }); 239 }; 240 Plugin.prototype._is_visible = function( _img, _evt ) { 241 var $_img = $(_img), 242 wt = $(window).scrollTop(), 243 wb = wt + $(window).height(), 244 it = $_img.offset().top, 245 ib = it + $_img.height(), 246 th = this.options.threshold; 247 if ( _evt && 'scroll' == _evt.type && this.options.load_all_images_on_first_scroll ) 248 return true; 249 250 return ib >= wt - th && it <= wb + th; 251 }; 252 Plugin.prototype._load_img = function( _img ) { 253 var $_img = $(_img), 254 _src = $_img.attr( this.options.attribute[0] ), 255 _src_set = $_img.attr( this.options.attribute[1] ), 256 _sizes = $_img.attr( this.options.attribute[2] ), 257 self = this; 258 259 $_img.parent().addClass('smart-loading'); 260 261 $_img.unbind('load_img') 262 .hide() 263 .removeAttr( this.options.attribute.join(' ') ) 264 .attr( 'sizes' , _sizes ) 265 .attr( 'srcset' , _src_set ) 266 .attr( 'src', _src ) 267 .load( function () { 268 if ( ! $_img.hasClass('tc-smart-loaded') ) { 269 $_img.fadeIn(self.options.fadeIn_options).addClass('tc-smart-loaded'); 270 } 271 if ( ( 'undefined' !== typeof $_img.attr('data-tcjp-recalc-dims') ) && ( false !== $_img.attr('data-tcjp-recalc-dims') ) ) { 272 var _width = $_img.originalWidth(), 273 _height = $_img.originalHeight(); 274 275 if ( 2 != _.size( _.filter( [ _width, _height ], function(num){ return _.isNumber( parseInt(num, 10) ) && num > 1; } ) ) ) 276 return; 277 $_img.removeAttr( 'data-tcjp-recalc-dims scale' ); 278 279 $_img.attr( 'width', _width ); 280 $_img.attr( 'height', _height ); 281 } 282 283 $_img.trigger('smartload'); 284 $_img.data('czr-smart-loaded', true ); 285 });//<= create a load() fn 286 if ( $_img[0].complete ) { 287 $_img.load(); 288 } 289 $_img.parent().removeClass('smart-loading'); 290 }; 291 $.fn[pluginName] = function ( options ) { 292 return this.each(function () { 293 if (!$.data(this, 'plugin_' + pluginName)) { 294 $.data(this, 'plugin_' + pluginName, 295 new Plugin( this, options )); 296 } 297 }); 298 }; 299})( jQuery, window ); 300(function ( $ ) { 301 var pluginName = 'extLinks', 302 defaults = { 303 addIcon : true, 304 iconClassName : 'tc-external', 305 newTab: true, 306 skipSelectors : { //defines the selector to skip when parsing the wrapper 307 classes : [], 308 ids : [] 309 }, 310 skipChildTags : ['IMG']//skip those tags if they are direct children of the current link element 311 }; 312 313 314 function Plugin( element, options ) { 315 this.$_el = $(element); 316 this.options = $.extend( {}, defaults, options) ; 317 this._href = $.trim( this.$_el.attr( 'href' ) ); 318 this.init(); 319 } 320 321 322 Plugin.prototype.init = function() { 323 var self = this, 324 $_external_icon = this.$_el.next( '.' + self.options.iconClassName ); 325 if ( ! this._is_eligible() ) { 326 if ( $_external_icon.length ) 327 $_external_icon.remove(); 328 return; 329 } 330 if ( this.options.addIcon && 0 === $_external_icon.length ) { 331 this.$_el.after('<span class="' + self.options.iconClassName + '">'); 332 } 333 if ( this.options.newTab && '_blank' != this.$_el.attr('target') ) 334 this.$_el.attr('target' , '_blank'); 335 }; 336 Plugin.prototype._is_eligible = function() { 337 var self = this; 338 if ( ! this._is_external( this._href ) ) 339 return; 340 if ( ! this._is_first_child_tag_allowed () ) 341 return;
342 if ( 2 != ( ['ids', 'classes'].filter( function( sel_type) { return self._is_selector_allowed(sel_type); } ) ).length ) 343 return; 344 345 var _is_eligible = true; 346 $.each( this.$_el.parents(), function() { 347 if ( 'underline' == $(this).css('textDecoration') ){ 348 _is_eligible = false; 349 return false; 350 } 351 }); 352 353 return true && _is_eligible; 354 }; 355 Plugin.prototype._is_selector_allowed = function( requested_sel_type ) { 356 if ( czrapp && czrapp.userXP && czrapp.userXP.isSelectorAllowed ) 357 return czrapp.userXP.isSelectorAllowed( this.$_el, this.options.skipSelectors, requested_sel_type); 358 359 var sel_type = 'ids' == requested_sel_type ? 'id' : 'class', 360 _selsToSkip = this.options.skipSelectors[requested_sel_type]; 361 if ( 'object' != typeof(this.options.skipSelectors) || ! this.options.skipSelectors[requested_sel_type] || ! $.isArray( this.options.skipSelectors[requested_sel_type] ) || 0 === this.options.skipSelectors[requested_sel_type].length ) 362 return true; 363 if ( this.$_el.parents( _selsToSkip.map( function( _sel ){ return 'id' == sel_type ? '#' + _sel : '.' + _sel; } ).join(',') ).length > 0 ) 364 return false; 365 if ( ! this.$_el.attr( sel_type ) ) 366 return true; 367 368 var _elSels = this.$_el.attr( sel_type ).split(' '), 369 _filtered = _elSels.filter( function(classe) { return -1 != $.inArray( classe , _selsToSkip ) ;}); 370 return 0 === _filtered.length; 371 }; 372 Plugin.prototype._is_first_child_tag_allowed = function() { 373 if ( 0 === this.$_el.children().length ) 374 return true; 375 376 var tagName = this.$_el.children().first()[0].tagName, 377 _tagToSkip = this.options.skipChildTags; 378 if ( ! $.isArray( _tagToSkip ) ) 379 return true; 380 _tagToSkip = _tagToSkip.map( function( _tag ) { return _tag.toUpperCase(); }); 381 return -1 == $.inArray( tagName , _tagToSkip ); 382 }; 383 Plugin.prototype._is_external = function( _href ) { 384 var _main_domain = (location.host).split('.').slice(-2).join('.'), 385 _reg = new RegExp( _main_domain ); 386 387 _href = $.trim( _href ); 388 389 if ( _href !== '' && _href != '#' && this._isValidURL( _href ) ) 390 return ! _reg.test( _href ); 391 return; 392 }; 393 Plugin.prototype._isValidURL = function( _url ){ 394 var _pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; 395 return _pattern.test( _url ); 396 }; 397 $.fn[pluginName] = function ( options ) { 398 return this.each(function () { 399 if (!$.data(this, 'plugin_' + pluginName)) { 400 $.data(this, 'plugin_' + pluginName, 401 new Plugin( this, options )); 402 } 403 }); 404 }; 405 406})( jQuery ); 407(function ( $, window ) { 408 var pluginName = 'centerImages', 409 defaults = { 410 enableCentering : true, 411 onresize : true, 412 onInit : true,//<= shall we smartload on init or wait for a custom event, typically smartload ? 413 oncustom : [],//list of event here 414 $containerToListen : null,//<= we might want to listen to custom event trigger to a parent container.Should be a jQuery obj 415 imgSel : 'img', 416 defaultCSSVal : { width : 'auto' , height : 'auto' }, 417 leftAdjust : 0, 418 zeroLeftAdjust : 0, 419 topAdjust : 0, 420 zeroTopAdjust : -2,//<= top ajustement for h-centered 421 enableGoldenRatio : false, 422 goldenRatioLimitHeightTo : 350, 423 goldenRatioVal : 1.618, 424 skipGoldenRatioClasses : ['no-gold-ratio'], 425 disableGRUnder : 767,//in pixels 426 useImgAttr:false,//uses the img height and width attributes if not visible (typically used for the customizr slider hidden images) 427 setOpacityWhenCentered : false,//this can be used to hide the image during the time it is centered
428 addCenteredClassWithDelay : 0,//<= a small delay can be required when we rely on the v-centered or h-centered css classes to set the opacity for example 429 opacity : 1 430 }; 431 432 function Plugin( element, options ) { 433 var self = this; 434 this.container = element; 435 this.options = $.extend( {}, defaults, options) ; 436 this._defaults = defaults; 437 this._name = pluginName; 438 this._customEvt = $.isArray(self.options.oncustom) ? self.options.oncustom : self.options.oncustom.split(' '); 439 this.init(); 440 } 441 Plugin.prototype.init = function () { 442 var self = this, 443 _do = function( _event_ ) { 444 _event_ = _event_ || 'init'; 445 self._maybe_apply_golden_r(); 446 var $_imgs = $( self.options.imgSel , self.container ); 447 if ( self.options.enableGoldenRatio ) { 448 $(window).bind( 449 'resize', 450 {}, 451 _.debounce( function( evt ) { self._maybe_apply_golden_r( evt ); }, 200 ) 452 ); 453 } 454 if ( 1 <= $_imgs.length && self.options.enableCentering ) { 455 self._parse_imgs( $_imgs, _event_ ); 456 } 457 }; 458 if ( self.options.onInit ) { 459 _do(); 460 } 461 if ( $.isArray( self._customEvt ) ) { 462 self._customEvt.map( function( evt ) { 463 var $_containerToListen = ( self.options.$containerToListen instanceof $ && 1 < self.options.$containerToListen.length ) ? self.options.$containerToListen : $( self.container ); 464 $_containerToListen.bind( evt, {} , function() { 465 _do( evt ); 466 }); 467 } ); 468 } 469 }; 470 Plugin.prototype._maybe_apply_golden_r = function() { 471 if ( ! this.options.enableGoldenRatio || ! this.options.goldenRatioVal || 0 === this.options.goldenRatioVal ) 472 return; 473 if ( ! this._is_selector_allowed() ) 474 return; 475 if ( ! this._is_window_width_allowed() ) { 476 $(this.container).attr('style' , ''); 477 return; 478 } 479 480 var new_height = Math.round( $(this.container).width() / this.options.goldenRatioVal ); 481 new_height = new_height > this.options.goldenRatioLimitHeightTo ? this.options.goldenRatioLimitHeightTo : new_height; 482 $(this.container) 483 .css({ 484 'line-height' : new_height + 'px', 485 height : new_height + 'px' 486 }) 487 .trigger('golden-ratio-applied'); 488 }; 489 Plugin.prototype._is_window_width_allowed = function() { 490 return $(window).width() > this.options.disableGRUnder - 15; 491 }; 492 Plugin.prototype._parse_imgs = function( $_imgs, _event_ ) { 493 var self = this; 494 $_imgs.each(function ( ind, img ) { 495 var $_img = $(img); 496 self._pre_img_cent( $_img, _event_ ); 497 if ( self.options.onresize && ! $_img.data('resize-react-bound' ) ) { 498 $_img.data('resize-react-bound', true ); 499 $(window).resize( _.debounce( function() { 500 self._pre_img_cent( $_img, 'resize'); 501 }, 100 ) ); 502 } 503 504 });//$_imgs.each() 505 if ( $(self.container).attr('data-img-centered-in-container') ) { 506 var _n = parseInt( $(self.container).attr('data-img-centered-in-container'), 10 ) + 1; 507 $(self.container).attr('data-img-centered-in-container', _n ); 508 } else { 509 $(self.container).attr('data-img-centered-in-container', 1 ); 510 } 511 }; 512 Plugin.prototype._pre_img_cent = function( $_img ) { 513 514 var _state = this._get_current_state( $_img ), 515 self = this, 516 _case = _state.current, 517 _p = _state.prop[_case], 518 _not_p = _state.prop[ 'h' == _case ? 'v' : 'h'], 519 _not_p_dir_val = 'h' == _case ? ( this.options.zeroTopAdjust || 0 ) : ( this.options.zeroLeftAdjust || 0 ); 520 521 var _centerImg = function( $_img ) { 522 $_img 523 .css( _p.dim.name , _p.dim.val ) 524 .css( _not_p.dim.name , self.options.defaultCSSVal[ _not_p.dim.name ] || 'auto' ) 525 .css( _p.dir.name, _p.dir.val ).css( _not_p.dir.
525name, _not_p_dir_val ); 526 527 if ( 0 !== self.options.addCenteredClassWithDelay && _.isNumber( self.options.addCenteredClassWithDelay ) ) { 528 _.delay( function() { 529 $_img.addClass( _p._class ).removeClass( _not_p._class ); 530 }, self.options.addCenteredClassWithDelay ); 531 } else { 532 $_img.addClass( _p._class ).removeClass( _not_p._class ); 533 } 534 if ( $_img.attr('data-img-centered') ) { 535 var _n = parseInt( $_img.attr('data-img-centered'), 10 ) + 1; 536 $_img.attr('data-img-centered', _n ); 537 } else { 538 $_img.attr('data-img-centered', 1 ); 539 } 540 return $_img; 541 }; 542 if ( this.options.setOpacityWhenCentered ) { 543 $.when( _centerImg( $_img ) ).done( function( $_img ) { 544 $_img.css( 'opacity', self.options.opacity ); 545 }); 546 } else { 547 _.delay(function() { _centerImg( $_img ); }, 0 ); 548 } 549 }; 550 Plugin.prototype._get_current_state = function( $_img ) { 551 var c_x = $_img.closest(this.container).outerWidth(), 552 c_y = $(this.container).outerHeight(), 553 i_x = this._get_img_dim( $_img , 'x'), 554 i_y = this._get_img_dim( $_img , 'y'), 555 up_i_x = i_y * c_y !== 0 ? Math.round( i_x / i_y * c_y ) : c_x, 556 up_i_y = i_x * c_x !== 0 ? Math.round( i_y / i_x * c_x ) : c_y, 557 current = 'h'; 558 if ( 0 !== c_x * i_x ) { 559 current = ( c_y / c_x ) >= ( i_y / i_x ) ? 'h' : 'v'; 560 } 561 562 var prop = { 563 h : { 564 dim : { name : 'height', val : c_y }, 565 dir : { name : 'left', val : ( c_x - up_i_x ) / 2 + ( this.options.leftAdjust || 0 ) }, 566 _class : 'h-centered' 567 }, 568 v : { 569 dim : { name : 'width', val : c_x }, 570 dir : { name : 'top', val : ( c_y - up_i_y ) / 2 + ( this.options.topAdjust || 0 ) }, 571 _class : 'v-centered' 572 } 573 }; 574 575 return { current : current , prop : prop }; 576 }; 577 Plugin.prototype._get_img_dim = function( $_img, _dim ) { 578 if ( ! this.options.useImgAttr ) 579 return 'x' == _dim ? $_img.outerWidth() : $_img.outerHeight(); 580 581 if ( $_img.is(":visible") ) { 582 return 'x' == _dim ? $_img.outerWidth() : $_img.outerHeight(); 583 } else { 584 if ( 'x' == _dim ){ 585 var _width = $_img.originalWidth(); 586 return typeof _width === undefined ? 0 : _width; 587 } 588 if ( 'y' == _dim ){ 589 var _height = $_img.originalHeight(); 590 return typeof _height === undefined ? 0 : _height; 591 } 592 } 593 }; 594 Plugin.prototype._is_selector_allowed = function() { 595 if ( ! $(this.container).attr( 'class' ) ) 596 return true; 597 if ( ! this.options.skipGoldenRatioClasses || ! $.isArray( this.options.skipGoldenRatioClasses ) ) 598 return true; 599 600 var _elSels = $(this.container).attr( 'class' ).split(' '), 601 _selsToSkip = this.options.skipGoldenRatioClasses, 602 _filtered = _elSels.filter( function(classe) { return -1 != $.inArray( classe , _selsToSkip ) ;}); 603 return 0 === _filtered.length; 604 }; 605 $.fn[pluginName] = function ( options ) { 606 return this.each(function () { 607 if (!$.data(this, 'plugin_' + pluginName)) { 608 $.data(this, 'plugin_' + pluginName, 609 new Plugin( this, options )); 610 } 611 }); 612 }; 613 614})( jQuery, window ); 615(function ( $, window, _ ) { 616 var pluginName = 'czrParallax', 617 defaults = { 618 parallaxRatio : 0.5, 619 parallaxDirection : 1, 620 parallaxOverflowHidden : true, 621 oncustom : [],//list of event here 622 backgroundClass : 'image', 623 matchMedia : 'only screen and (max-width: 768px)' 624 }; 625 626 function Plugin( element, options ) { 627 this.element = $(element); 628 this.element_wrapper = this.element.closest( '.parallax-wrapper' ); 629 this.options = $.extend( {}, defaults, options, this.parseElementDataOptions() ) ; 630 this._defaults = defaults; 631 this._name = pluginName; 632 this.init(); 633 } 634 635 Plugin.prototype.parseElementDataOptions = function () { 636 return this.element.data(); 637 }; 638 Plugin.prototype.init = function () { 639 this.$_document = $(document); 640 this.$_window = czrapp ? czrapp.$_window : $(window); 641 this.doingAnimation = false; 642 643 this.initWaypoints();
644 this.stageParallaxElements(); 645 this._bind_evt(); 646 }; 647 Plugin.prototype._bind_evt = function() { 648 649 _.bindAll( this, 'maybeParallaxMe', 'parallaxMe' ); 650 }; 651 652 Plugin.prototype.stageParallaxElements = function() { 653 654 this.element.css({ 655 'position': this.element.hasClass( this.options.backgroundClass ) ? 'absolute' : 'relative', 656 'will-change': 'transform' 657 }); 658 659 if ( this.options.parallaxOverflowHidden ){ 660 var $_wrapper = this.element_wrapper; 661 if ( $_wrapper.length ) 662 $_wrapper.css( 'overflow', 'hidden' ); 663 } 664 }; 665 666 Plugin.prototype.initWaypoints = function() { 667 var self = this; 668 669 this.way_start = new Waypoint({ 670 element: self.element_wrapper.length ? self.element_wrapper : self.element, 671 handler: function() { 672 self.maybeParallaxMe(); 673 if ( ! self.element.hasClass('parallaxing') ){ 674 self.$_window.on('scroll', self.maybeParallaxMe ); 675 self.element.addClass('parallaxing'); 676 } else{ 677 self.element.removeClass('parallaxing'); 678 self.$_window.off('scroll', self.maybeParallaxMe ); 679 self.doingAnimation = false; 680 self.element.css('top', 0 ); 681 } 682 } 683 }); 684 685 this.way_stop = new Waypoint({ 686 element: self.element_wrapper.length ? self.element_wrapper : self.element, 687 handler: function() { 688 self.maybeParallaxMe(); 689 if ( ! self.element.hasClass('parallaxing') ) { 690 self.$_window.on('scroll', self.maybeParallaxMe ); 691 self.element.addClass('parallaxing'); 692 }else { 693 self.element.removeClass('parallaxing'); 694 self.$_window.off('scroll', self.maybeParallaxMe ); 695 self.doingAnimation = false; 696 } 697 }, 698 offset: function(){ 699 return - this.adapter.outerHeight(); 700 } 701 }); 702 }; 703 Plugin.prototype.maybeParallaxMe = function() { 704 var self = this; 705 if ( _.isFunction( window.matchMedia ) && matchMedia( self.options.matchMedia ).matches ) 706 return this.setTopPosition(); 707 708 if ( ! this.doingAnimation ) { 709 this.doingAnimation = true; 710 window.requestAnimationFrame(function() { 711 self.parallaxMe(); 712 self.doingAnimation = false; 713 }); 714 } 715 }; 716 Plugin.prototype.setTopPosition = function( _top_ ) { 717 _top_ = _top_ || 0; 718 this.element.css({ 719 'transform' : 'translate3d(0px, ' + _top_ + 'px, .01px)', 720 '-webkit-transform' : 'translate3d(0px, ' + _top_ + 'px, .01px)' 721 }); 722 }; 723 724 Plugin.prototype.parallaxMe = function() { 725 726 var ratio = this.options.parallaxRatio, 727 parallaxDirection = this.options.parallaxDirection, 728 value = ratio * parallaxDirection * ( this.$_document.scrollTop() - this.way_start.triggerPoint ); 729 this.setTopPosition( parallaxDirection * value < 0 ? 0 : value ); 730 }; 731 $.fn[pluginName] = function ( options ) { 732 return this.each(function () { 733 if (!$.data(this, 'plugin_' + pluginName)) { 734 $.data(this, 'plugin_' + pluginName, 735 new Plugin( this, options )); 736 } 737 }); 738 }; 739})( jQuery, window, _ ); 740(function ( $, window, document, _ ) { 741 var pluginName = 'animateSvg', 742 defaults = { 743 filter_opacity : 0.8, 744 svg_opacity : 0.8, 745 animation_duration : 400 746 }, 747 _drawSvgIcon = function(options) { 748 var id = $(this).attr('id'); 749 if ( _.isUndefined(id) || _.isEmpty(id) || 'function' != typeof( Vivus ) ) { 750 if ( window.czrapp ) 751 czrapp.consoleLog( 'An svg icon could not be animated with Vivus.'); 752 return; 753 } 754 if ( $('[id=' + id + ']').length > 1 ) { 755 if ( window.czrapp ) 756 czrapp.consoleLog( 'Svg icons must have a unique css #id to be animated. Multiple id found for : ' + id ); 757 } 758 var set_opacity = function() { 759 if ( $('#' + id ).siblings('.filter-placeholder').length ) 760 return $('#' + id ).css('opacity', options.svg_opacity ).siblings('.filter-placeholder').css('opacity', options.filter_opacity); 761 else 762 return $('#' + id ).css('opacity', options.svg_opacity ); 763 };
764 $.when( set_opacity() ).done( function() { 765 new Vivus( id, {type: 'delayed', duration: options.animation_duration } ); 766 }); 767 }; 768 $.fn[pluginName] = function ( options ) { 769 options = $.extend( {}, defaults, options) ; 770 return this.each(function () { 771 if ( ! $.data(this, 'plugin_' + pluginName) ) { 772 $.data( 773 this, 774 'plugin_' + pluginName, 775 _drawSvgIcon.call( this, options ) 776 ); 777 } 778 }); 779 }; 780})( jQuery, window, document, _ );// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 781(function() { 782 var lastTime = 0; 783 var vendors = ['ms', 'moz', 'webkit', 'o']; 784 for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 785 window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; 786 window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] 787 || window[vendors[x]+'CancelRequestAnimationFrame']; 788 } 789 790 if (!window.requestAnimationFrame) 791 window.requestAnimationFrame = function(callback, element) { 792 var currTime = new Date().getTime(); 793 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 794 lastTime = currTime + timeToCall; 795 return window.setTimeout(function() { callback(currTime + timeToCall); }, 796 timeToCall); 797 }; 798 799 if (!window.cancelAnimationFrame) 800 window.cancelAnimationFrame = function(id) { 801 clearTimeout(id); 802 }; 803}());/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ 804 805window.matchMedia || (window.matchMedia = function() { 806 "use strict"; 807 var styleMedia = (window.styleMedia || window.media); 808 if (!styleMedia) { 809 var style = document.createElement('style'), 810 script = document.getElementsByTagName('script')[0], 811 info = null; 812 813 style.type = 'text/css'; 814 style.id = 'matchmediajs-test'; 815 816 if (!script) { 817 document.head.appendChild(style); 818 } else { 819 script.parentNode.insertBefore(style, script); 820 } 821 info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle; 822 823 styleMedia = { 824 matchMedium: function(media) { 825 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 826 if (style.styleSheet) { 827 style.styleSheet.cssText = text; 828 } else { 829 style.textContent = text; 830 } 831 return info.width === '1px'; 832 } 833 }; 834 } 835 836 return function(media) { 837 return { 838 matches: styleMedia.matchMedium(media || 'all'), 839 media: media || 'all' 840 }; 841 }; 842}());// Press Customizr version of Galambosi's SmoothScroll 843 844(function () { 845var defaultOptions = { 846 frameRate : 150, // [Hz] 847 animationTime : 400, // [px] 848 stepSize : 120, // [px] 849 pulseAlgorithm : true, 850 pulseScale : 4, 851 pulseNormalize : 1, 852 accelerationDelta : 20, // 20 853 accelerationMax : 1, // 1 854 keyboardSupport : true, // option 855 arrowScroll : 50, // [px] 856 touchpadSupport : true, 857 fixedBackground : true, 858 excluded : '' 859}; 860 861var options = defaultOptions; 862var isExcluded = false; 863var isFrame = false; 864var direction = { x: 0, y: 0 }; 865var initDone = false; 866var root = document.documentElement; 867var activeElement; 868var observer; 869var deltaBuffer = []; 870var isMac = /^Mac/.test(navigator.platform); 871 872var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, 873 pageup: 33, pagedown: 34, end: 35, home: 36 }; 874 875var options = defaultOptions; 876function initTest() { 877 if (options.keyboardSupport) { 878 addEvent('keydown', keydown); 879 } 880}
vendor: 6,204 bytes, lines 881-1079
881function init() { 882 883 if (initDone || !document.body) return; 884 885 initDone = true; 886 887 var body = document.body; 888 var html = document.documentElement; 889 var windowHeight = window.innerHeight; 890 var scrollHeight = body.scrollHeight; 891 root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; 892 activeElement = body; 893 894 initTest(); 895 if (top != self) { 896 isFrame = true; 897 } 898 else if (scrollHeight > windowHeight && 899 (body.offsetHeight <= windowHeight || 900 html.offsetHeight <= windowHeight)) { 901 902 var fullPageElem = document.createElement('div'); 903 fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' + 904 'top:0; left:0; right:0; height:' + 905 root.scrollHeight + 'px'; 906 document.body.appendChild(fullPageElem); 907 var pendingRefresh; 908 var refresh = function () { 909 if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh); 910 pendingRefresh = setTimeout(function () { 911 if (isExcluded) return; // could be running after cleanup 912 fullPageElem.style.height = '0'; 913 fullPageElem.style.height = root.scrollHeight + 'px'; 914 pendingRefresh = null; 915 }, 500); // act rarely to stay fast 916 }; 917 918 setTimeout(refresh, 10); 919 var config = { 920 attributes: true, 921 childList: true, 922 characterData: false 923 }; 924 925 observer = new MutationObserver(refresh); 926 observer.observe(body, config); 927 928 if (root.offsetHeight <= windowHeight) { 929 var clearfix = document.createElement('div'); 930 clearfix.style.clear = 'both'; 931 body.appendChild(clearfix); 932 } 933 } 934 if (!options.fixedBackground && !isExcluded) { 935 body.style.backgroundAttachment = 'scroll'; 936 html.style.backgroundAttachment = 'scroll'; 937 } 938} 939function cleanup() { 940 observer && observer.disconnect(); 941 removeEvent(wheelEvent, wheel, wheelOpt); 942 removeEvent('mousedown', mousedown); 943 removeEvent('keydown', keydown); 944} 945var que = []; 946var pending = false; 947var lastScroll = Date.now(); 948function scrollArray(elem, left, top) { 949 950 directionCheck(left, top); 951 952 if (options.accelerationMax != 1) { 953 var now = Date.now(); 954 var elapsed = now - lastScroll; 955 if (elapsed < options.accelerationDelta) { 956 var factor = (1 + (50 / elapsed)) / 2; 957 if (factor > 1) { 958 factor = Math.min(factor, options.accelerationMax); 959 left *= factor; 960 top *= factor; 961 } 962 } 963 lastScroll = Date.now(); 964 } 965 que.push({ 966 x: left, 967 y: top, 968 lastX: (left < 0) ? 0.99 : -0.99, 969 lastY: (top < 0) ? 0.99 : -0.99, 970 start: Date.now() 971 }); 972 if (pending) { 973 return; 974 } 975 976 var scrollWindow = (elem === document.body); 977 978 var step = function (time) { 979 980 var now = Date.now(); 981 var scrollX = 0; 982 var scrollY = 0; 983 984 for (var i = 0; i < que.length; i++) { 985 986 var item = que[i]; 987 var elapsed = now - item.start; 988 var finished = (elapsed >= options.animationTime); 989 var position = (finished) ? 1 : elapsed / options.animationTime; 990 if (options.pulseAlgorithm) { 991 position = pulse(position); 992 } 993 var x = (item.x * position - item.lastX) >> 0; 994 var y = (item.y * position - item.lastY) >> 0; 995 scrollX += x; 996 scrollY += y; 997 item.lastX += x; 998 item.lastY += y; 999 if (finished) { 1000 que.splice(i, 1); i--; 1001 } 1002 } 1003 if (scrollWindow) { 1004 window.scrollBy(scrollX, scrollY); 1005 } 1006 else { 1007 if (scrollX) elem.scrollLeft += scrollX; 1008 if (scrollY) elem.scrollTop += scrollY; 1009 } 1010 if (!left && !top) { 1011 que = []; 1012 } 1013 1014 if (que.length) { 1015 requestFrame(step, elem, (1000 / options.frameRate + 1)); 1016 } else { 1017 pending = false; 1018 } 1019 }; 1020 requestFrame(step, elem, 0); 1021 pending = true; 1022} 1023function wheel(event) { 1024 1025 if (!initDone) { 1026 init(); 1027 } 1028 1029 var target = event.target; 1030 var overflowing = overflowingAncestor(target); 1031 if (!overflowing || event.defaultPrevented || event.ctrlKey) { 1032 return true; 1033 } 1034 if (isNodeName(activeElement, 'embed') || 1035 (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) || 1036 isNodeName(activeElement, 'object')) { 1037 return true; 1038 } 1039 1040 var deltaX = -event.wheelDeltaX || event.deltaX || 0; 1041 var deltaY = -event.wheelDeltaY || event.deltaY || 0; 1042 1043 if (isMac) { 1044 if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) { 1045 deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX)); 1046 } 1047 if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) { 1048 deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY)); 1049 } 1050 } 1051 if (!deltaX && !deltaY) { 1052 deltaY = -event.wheelDelta || 0; 1053 } 1054 if (event.deltaMode === 1) { 1055 deltaX *= 40; 1056 deltaY *= 40; 1057 } 1058 if (!options.touchpadSupport && isTouchpad(deltaY)) { 1059 return true; 1060 } 1061 if (Math.abs(deltaX) > 1.2) { 1062 deltaX *= options.stepSize / 120; 1063 } 1064 if (Math.abs(deltaY) > 1.2) { 1065 deltaY *= options.stepSize / 120; 1066 } 1067 1068 scrollArray(overflowing, deltaX, deltaY); 1069 event.preventDefault(); 1070 scheduleClearCache(); 1071} 1072function keydown(event) { 1073 1074 var target = event.target; 1075 var modifier = event.ctrlKey || event.altKey || event.metaKey || 1076 (event.shiftKey && event.keyCode !== key.spacebar); 1077 if (!document.contains(activeElement)) { 1078 activeElement = document.activeElement; 1079 }
1080 var inputNodeNames = /^(textarea|select|embed|object)$/i; 1081 var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i; 1082 if ( inputNodeNames.test(target.nodeName) || 1083 isNodeName(target, 'input') && !buttonTypes.test(target.type) || 1084 isNodeName(activeElement, 'video') || 1085 isInsideYoutubeVideo(event) || 1086 target.isContentEditable || 1087 event.defaultPrevented || 1088 modifier ) { 1089 return true; 1090 } 1091 if ((isNodeName(target, 'button') || 1092 isNodeName(target, 'input') && buttonTypes.test(target.type)) && 1093 event.keyCode === key.spacebar) { 1094 return true; 1095 } 1096 1097 var shift, x = 0, y = 0; 1098 var elem = overflowingAncestor(activeElement); 1099 var clientHeight = elem.clientHeight; 1100 1101 if (elem == document.body) { 1102 clientHeight = window.innerHeight; 1103 } 1104 1105 switch (event.keyCode) { 1106 case key.up: 1107 y = -options.arrowScroll; 1108 break; 1109 case key.down: 1110 y = options.arrowScroll; 1111 break; 1112 case key.spacebar: // (+ shift) 1113 shift = event.shiftKey ? 1 : -1; 1114 y = -shift * clientHeight * 0.9; 1115 break; 1116 case key.pageup: 1117 y = -clientHeight * 0.9; 1118 break; 1119 case key.pagedown: 1120 y = clientHeight * 0.9; 1121 break; 1122 case key.home: 1123 y = -elem.scrollTop; 1124 break; 1125 case key.end: 1126 var damt = elem.scrollHeight - elem.scrollTop - clientHeight; 1127 y = (damt > 0) ? damt+10 : 0; 1128 break; 1129 case key.left: 1130 x = -options.arrowScroll; 1131 break; 1132 case key.right: 1133 x = options.arrowScroll; 1134 break; 1135 default: 1136 return true; // a key we don't care about 1137 } 1138 1139 scrollArray(elem, x, y); 1140 event.preventDefault(); 1141 scheduleClearCache(); 1142} 1143function mousedown(event) { 1144 activeElement = event.target; 1145} 1146 1147var uniqueID = (function () { 1148 var i = 0; 1149 return function (el) { 1150 return el.uniqueID || (el.uniqueID = i++); 1151 }; 1152})(); 1153 1154var cache = {}; // cleared out after a scrolling session 1155var clearCacheTimer; 1156 1157function scheduleClearCache() { 1158 clearTimeout(clearCacheTimer); 1159 clearCacheTimer = setInterval(function () { cache = {}; }, 1*1000); 1160} 1161 1162function setCache(elems, overflowing) { 1163 for (var i = elems.length; i--;) 1164 cache[uniqueID(elems[i])] = overflowing; 1165 return overflowing; 1166} 1167 1168function overflowingAncestor(el) { 1169 var elems = []; 1170 var body = document.body; 1171 var rootScrollHeight = root.scrollHeight; 1172 do { 1173 var cached = cache[uniqueID(el)]; 1174 if (cached) { 1175 return setCache(elems, cached); 1176 } 1177 elems.push(el); 1178 if (rootScrollHeight === el.scrollHeight) { 1179 var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body); 1180 var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root); 1181 if (isFrame && isContentOverflowing(root) || 1182 !isFrame && isOverflowCSS) { 1183 return setCache(elems, getScrollRoot()); 1184 } 1185 } else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) { 1186 return setCache(elems, el); 1187 } 1188 } while (el = el.parentElement); 1189} 1190 1191function isContentOverflowing(el) { 1192 return (el.clientHeight + 10 < el.scrollHeight); 1193} 1194function overflowNotHidden(el) { 1195 var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); 1196 return (overflow !== 'hidden'); 1197} 1198function overflowAutoOrScroll(el) { 1199 var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); 1200 return (overflow === 'scroll' || overflow === 'auto'); 1201} 1202 1203function addEvent(type, fn, arg ) { 1204 window.addEventListener(type, fn, arg || false); 1205} 1206 1207function removeEvent(type, fn, arg) { 1208 window.removeEventListener(type, fn, arg || false); 1209} 1210 1211function isNodeName(el, tag) { 1212 return (el.nodeName||'').toLowerCase() === tag.toLowerCase(); 1213} 1214 1215function directionCheck(x, y) { 1216 x = (x > 0) ? 1 : -1; 1217 y = (y > 0) ? 1 : -1; 1218 if (direction.x !== x || direction.y !== y) { 1219 direction.x = x; 1220 direction.y = y; 1221 que = []; 1222 lastScroll = 0; 1223 } 1224} 1225 1226var deltaBufferTimer; 1227 1228if (window.localStorage && localStorage.SS_deltaBuffer) { 1229 deltaBuffer = localStorage.SS_deltaBuffer.split(','); 1230} 1231 1232function isTouchpad(deltaY) { 1233 if (!deltaY) return; 1234 if (!deltaBuffer.length) { 1235 deltaBuffer = [deltaY, deltaY, deltaY]; 1236 } 1237 deltaY = Math.abs(deltaY) 1238 deltaBuffer.push(deltaY); 1239 deltaBuffer.shift(); 1240 clearTimeout(deltaBufferTimer); 1241 deltaBufferTimer = setTimeout(function () { 1242 if (window.localStorage) { 1243 localStorage.SS_deltaBuffer = deltaBuffer.join(','); 1244 } 1245 }, 1000); 1246 return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100); 1247} 1248 1249function isDivisible(n, divisor) { 1250 return (Math.floor(n / divisor) == n / divisor); 1251} 1252 1253function allDeltasDivisableBy(divisor) { 1254 return (isDivisible(deltaBuffer[0], divisor) && 1255 isDivisible(deltaBuffer[1], divisor) && 1256 isDivisible(deltaBuffer[2], divisor)); 1257} 1258 1259function isInsideYoutubeVideo(event) { 1260 var elem = event.target; 1261 var isControl = false; 1262 if (document.URL.indexOf ('www.youtube.com/watch') != -1) { 1263 do { 1264 isControl = (elem.classList && 1265 elem.classList.contains('html5-video-controls')); 1266 if (isControl) break; 1267 } while (elem = elem.parentNode); 1268 } 1269 return isControl; 1270} 1271 1272var requestFrame = (function () { 1273 return (window.requestAnimationFrame || 1274 window.webkitRequestAnimationFrame || 1275 window.mozRequestAnimationFrame || 1276 function (callback, element, delay) { 1277 window.setTimeout(callback, delay || (1000/60)); 1278 }); 1279})(); 1280 1281var MutationObserver = (window.MutationObserver || 1282 window.WebKitMutationObserver || 1283 window.MozMutationObserver); 1284 1285var getScrollRoot = (function() { 1286 var SCROLL_ROOT; 1287 return function() { 1288 if (!SCROLL_ROOT) { 1289 var dummy = document.createElement('div'); 1290 dummy.style.cssText = 'height:10000px;width:1px;'; 1291 document.body.appendChild(dummy); 1292 var bodyScrollTop = document.body.scrollTop; 1293 var docElScrollTop = document.documentElement.scrollTop; 1294 window.scrollBy(0, 1); 1295 if (document.body.scrollTop != bodyScrollTop) 1296 (SCROLL_ROOT = document.body); 1297 else 1298 (SCROLL_ROOT = document.documentElement); 1299 window.scrollBy(0, -1); 1300 document.body.removeChild(dummy); 1301 } 1302 return SCROLL_ROOT; 1303 }; 1304})(); 1305function pulse_(x) { 1306 var val, start, expx; 1307 x = x * options.pulseScale; 1308 if (x < 1) { // acceleartion 1309 val = x - (1 - Math.exp(-x)); 1310 } else { // tail 1311 start = Math.exp(-1); 1312 x -= 1; 1313 expx = 1 - Math.exp(-x); 1314 val = start + (expx * (1 - start)); 1315 }
1316 return val * options.pulseNormalize; 1317} 1318 1319function pulse(x) { 1320 if (x >= 1) return 1; 1321 if (x <= 0) return 0; 1322 1323 if (options.pulseNormalize == 1) { 1324 options.pulseNormalize /= pulse_(1); 1325 } 1326 return pulse_(x); 1327} 1328 1329var supportsPassive = false; 1330try { 1331 window.addEventListener("test", null, Object.defineProperty({}, 'passive', { 1332 get: function () { 1333 supportsPassive = true; 1334 } 1335 })); 1336} catch(e) {} 1337 1338var wheelOpt = supportsPassive ? { passive: false } : false; 1339var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel'; 1340function _maybeInit( fire ){ 1341 if (wheelEvent) { 1342 addEvent(wheelEvent, wheel, wheelOpt); 1343 addEvent('mousedown', mousedown); 1344 if ( ! fire ) addEvent('load', init); 1345 else init(); 1346 } 1347 return wheelEvent ? true : false; 1348} 1349smoothScroll = function ( _options ) { 1350 smoothScroll._setCustomOptions( _options ); 1351 _maybeInit(); 1352 czrapp.$_body.addClass('hu-smoothscroll'); 1353}; 1354smoothScroll._cleanUp = function(){ 1355 cleanup(); 1356 czrapp.$_body.removeClass('hu-smoothscroll'); 1357}; 1358smoothScroll._maybeFire = function(){ 1359 _maybeInit(true); 1360 czrapp.$_body.addClass('hu-smoothscroll'); 1361}; 1362smoothScroll._setCustomOptions = function( _options ){ 1363 options = _options ? _.extend( options, _options) : options; 1364}; 1365})(); 1366 1367var smoothScroll;// modified version of 1368var tcOutline; 1369(function(d){ 1370 tcOutline = function() { 1371 var style_element = d.createElement('STYLE'), 1372 dom_events = 'addEventListener' in d, 1373 add_event_listener = function(type, callback){ 1374 if(dom_events){ 1375 d.addEventListener(type, callback); 1376 }else{ 1377 d.attachEvent('on' + type, callback); 1378 } 1379 }, 1380 set_css = function(css_text){ 1381 if ( !!style_element.styleSheet ) 1382 style_element.styleSheet.cssText = css_text; 1383 else 1384 style_element.innerHTML = css_text; 1385 } 1386 ; 1387 1388 d.getElementsByTagName('HEAD')[0].appendChild(style_element); 1389 add_event_listener('mousedown', function(){ 1390 set_css('input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus,select:focus,a:focus{outline:0}input[type=file]::-moz-focus-inner,input[type=radio]::-moz-focus-inner,input[type=checkbox]::-moz-focus-inner,select::-moz-focus-inner,a::-moz-focus-inner{border:0;}'); 1391 }); 1392 1393 add_event_listener('keydown', function(){ 1394 set_css(''); 1395 }); 1396 } 1397})(document); 1398/*! 1399Waypoints - 4.0.0 1400Copyright © 2011-2015 Caleb Troughton 1401Licensed under the MIT license. 1402https://github.com/imakewebthings/waypoints/blob/master/licenses.txt 1403*/ 1404(function() { 1405 'use strict' 1406 1407 var keyCounter = 0 1408 var allWaypoints = {} 1409 function Waypoint(options) { 1410 if (!options) { 1411 throw new Error('No options passed to Waypoint constructor') 1412 } 1413 if (!options.element) { 1414 throw new Error('No element option passed to Waypoint constructor') 1415 } 1416 if (!options.handler) { 1417 throw new Error('No handler option passed to Waypoint constructor') 1418 } 1419 1420 this.key = 'waypoint-' + keyCounter 1421 this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options) 1422 this.element = this.options.element 1423 this.adapter = new Waypoint.Adapter(this.element) 1424 this.callback = options.handler 1425 this.axis = this.options.horizontal ? 'horizontal' : 'vertical' 1426 this.enabled = this.options.enabled 1427 this.triggerPoint = null 1428 this.group = Waypoint.Group.findOrCreate({ 1429 name: this.options.group, 1430 axis: this.axis 1431 }) 1432 this.context = Waypoint.Context.findOrCreateByElement(this.options.context) 1433 1434 if (Waypoint.offsetAliases[this.options.offset]) { 1435 this.options.offset = Waypoint.offsetAliases[this.options.offset] 1436 } 1437 this.group.add(this) 1438 this.context.add(this) 1439 allWaypoints[this.key] = this 1440 keyCounter += 1 1441 } 1442 Waypoint.prototype.queueTrigger = function(direction) { 1443 this.group.queueTrigger(this, direction) 1444 } 1445 Waypoint.prototype.trigger = function(args) { 1446 if (!this.enabled) { 1447 return 1448 } 1449 if (this.callback) { 1450 this.callback.apply(this, args) 1451 } 1452 } 1453 Waypoint.prototype.destroy = function() { 1454 this.context.remove(this) 1455 this.group.remove(this) 1456 delete allWaypoints[this.key] 1457 } 1458 Waypoint.prototype.disable = function() { 1459 this.enabled = false 1460 return this 1461 } 1462 Waypoint.prototype.enable = function() { 1463 this.context.refresh() 1464 this.enabled = true 1465 return this 1466 } 1467 Waypoint.prototype.next = function() { 1468 return this.group.next(this) 1469 } 1470 Waypoint.prototype.previous = function() { 1471 return this.group.previous(this) 1472 } 1473 Waypoint.invokeAll = function(method) { 1474 var allWaypointsArray = []
1475 for (var waypointKey in allWaypoints) { 1476 allWaypointsArray.push(allWaypoints[waypointKey]) 1477 } 1478 for (var i = 0, end = allWaypointsArray.length; i < end; i++) { 1479 allWaypointsArray[i][method]() 1480 } 1481 } 1482 Waypoint.destroyAll = function() { 1483 Waypoint.invokeAll('destroy') 1484 } 1485 Waypoint.disableAll = function() { 1486 Waypoint.invokeAll('disable') 1487 } 1488 Waypoint.enableAll = function() { 1489 Waypoint.invokeAll('enable') 1490 } 1491 Waypoint.refreshAll = function() { 1492 Waypoint.Context.refreshAll() 1493 } 1494 Waypoint.viewportHeight = function() { 1495 return window.innerHeight || document.documentElement.clientHeight 1496 } 1497 Waypoint.viewportWidth = function() { 1498 return document.documentElement.clientWidth 1499 } 1500 1501 Waypoint.adapters = [] 1502 1503 Waypoint.defaults = { 1504 context: window, 1505 continuous: true, 1506 enabled: true, 1507 group: 'default', 1508 horizontal: false, 1509 offset: 0 1510 } 1511 1512 Waypoint.offsetAliases = { 1513 'bottom-in-view': function() { 1514 return this.context.innerHeight() - this.adapter.outerHeight() 1515 }, 1516 'right-in-view': function() { 1517 return this.context.innerWidth() - this.adapter.outerWidth() 1518 } 1519 } 1520 1521 window.Waypoint = Waypoint 1522}()) 1523;(function() { 1524 'use strict' 1525 1526 function requestAnimationFrameShim(callback) { 1527 window.setTimeout(callback, 1000 / 60) 1528 } 1529 1530 var keyCounter = 0 1531 var contexts = {} 1532 var Waypoint = window.Waypoint 1533 var oldWindowLoad = window.onload 1534 function Context(element) { 1535 this.element = element 1536 this.Adapter = Waypoint.Adapter 1537 this.adapter = new this.Adapter(element) 1538 this.key = 'waypoint-context-' + keyCounter 1539 this.didScroll = false 1540 this.didResize = false 1541 this.oldScroll = { 1542 x: this.adapter.scrollLeft(), 1543 y: this.adapter.scrollTop() 1544 } 1545 this.waypoints = { 1546 vertical: {}, 1547 horizontal: {} 1548 } 1549 1550 element.waypointContextKey = this.key 1551 contexts[element.waypointContextKey] = this 1552 keyCounter += 1 1553 1554 this.createThrottledScrollHandler() 1555 this.createThrottledResizeHandler() 1556 } 1557 Context.prototype.add = function(waypoint) { 1558 var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical' 1559 this.waypoints[axis][waypoint.key] = waypoint 1560 this.refresh() 1561 } 1562 Context.prototype.checkEmpty = function() { 1563 var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal) 1564 var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical) 1565 if (horizontalEmpty && verticalEmpty) { 1566 this.adapter.off('.waypoints') 1567 delete contexts[this.key] 1568 } 1569 } 1570 Context.prototype.createThrottledResizeHandler = function() { 1571 var self = this 1572 1573 function resizeHandler() { 1574 self.handleResize() 1575 self.didResize = false 1576 } 1577 1578 this.adapter.on('resize.waypoints', function() { 1579 if (!self.didResize) { 1580 self.didResize = true 1581 Waypoint.requestAnimationFrame(resizeHandler) 1582 } 1583 }) 1584 } 1585 Context.prototype.createThrottledScrollHandler = function() { 1586 var self = this 1587 function scrollHandler() { 1588 self.handleScroll() 1589 self.didScroll = false 1590 } 1591 1592 this.adapter.on('scroll.waypoints', function() { 1593 if (!self.didScroll || Waypoint.isTouch) { 1594 self.didScroll = true 1595 Waypoint.requestAnimationFrame(scrollHandler) 1596 } 1597 }) 1598 } 1599 Context.prototype.handleResize = function() { 1600 Waypoint.Context.refreshAll() 1601 } 1602 Context.prototype.handleScroll = function() { 1603 var triggeredGroups = {} 1604 var axes = { 1605 horizontal: { 1606 newScroll: this.adapter.scrollLeft(), 1607 oldScroll: this.oldScroll.x, 1608 forward: 'right', 1609 backward: 'left' 1610 }, 1611 vertical: { 1612 newScroll: this.adapter.scrollTop(), 1613 oldScroll: this.oldScroll.y, 1614 forward: 'down', 1615 backward: 'up' 1616 } 1617 } 1618 1619 for (var axisKey in axes) { 1620 var axis = axes[axisKey] 1621 var isForward = axis.newScroll > axis.oldScroll 1622 var direction = isForward ? axis.forward : axis.backward 1623
1624 for (var waypointKey in this.waypoints[axisKey]) { 1625 var waypoint = this.waypoints[axisKey][waypointKey] 1626 var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint 1627 var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint 1628 var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint 1629 var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint 1630 if (crossedForward || crossedBackward) { 1631 waypoint.queueTrigger(direction) 1632 triggeredGroups[waypoint.group.id] = waypoint.group 1633 } 1634 } 1635 } 1636 1637 for (var groupKey in triggeredGroups) { 1638 triggeredGroups[groupKey].flushTriggers() 1639 } 1640 1641 this.oldScroll = { 1642 x: axes.horizontal.newScroll, 1643 y: axes.vertical.newScroll 1644 } 1645 } 1646 Context.prototype.innerHeight = function() { 1647 if (this.element == this.element.window) { 1648 return Waypoint.viewportHeight() 1649 } 1650 return this.adapter.innerHeight() 1651 } 1652 Context.prototype.remove = function(waypoint) { 1653 delete this.waypoints[waypoint.axis][waypoint.key] 1654 this.checkEmpty() 1655 } 1656 Context.prototype.innerWidth = function() { 1657 if (this.element == this.element.window) { 1658 return Waypoint.viewportWidth() 1659 } 1660 return this.adapter.innerWidth() 1661 } 1662 Context.prototype.destroy = function() { 1663 var allWaypoints = [] 1664 for (var axis in this.waypoints) {
1665 for (var waypointKey in this.waypoints[axis]) { 1666 allWaypoints.push(this.waypoints[axis][waypointKey]) 1667 } 1668 } 1669 for (var i = 0, end = allWaypoints.length; i < end; i++) { 1670 allWaypoints[i].destroy() 1671 } 1672 } 1673 Context.prototype.refresh = function() { 1674 var isWindow = this.element == this.element.window 1675 var contextOffset = isWindow ? undefined : this.adapter.offset() 1676 var triggeredGroups = {} 1677 var axes 1678 1679 this.handleScroll() 1680 axes = { 1681 horizontal: { 1682 contextOffset: isWindow ? 0 : contextOffset.left, 1683 contextScroll: isWindow ? 0 : this.oldScroll.x, 1684 contextDimension: this.innerWidth(), 1685 oldScroll: this.oldScroll.x, 1686 forward: 'right', 1687 backward: 'left', 1688 offsetProp: 'left' 1689 }, 1690 vertical: { 1691 contextOffset: isWindow ? 0 : contextOffset.top, 1692 contextScroll: isWindow ? 0 : this.oldScroll.y, 1693 contextDimension: this.innerHeight(), 1694 oldScroll: this.oldScroll.y, 1695 forward: 'down', 1696 backward: 'up', 1697 offsetProp: 'top' 1698 } 1699 } 1700 1701 for (var axisKey in axes) { 1702 var axis = axes[axisKey]
1703 for (var waypointKey in this.waypoints[axisKey]) { 1704 var waypoint = this.waypoints[axisKey][waypointKey] 1705 var adjustment = waypoint.options.offset 1706 var oldTriggerPoint = waypoint.triggerPoint 1707 var elementOffset = 0 1708 var freshWaypoint = oldTriggerPoint == null 1709 var contextModifier, wasBeforeScroll, nowAfterScroll 1710 var triggeredBackward, triggeredForward 1711 1712 if (waypoint.element !== waypoint.element.window) { 1713 elementOffset = waypoint.adapter.offset()[axis.offsetProp] 1714 } 1715 1716 if (typeof adjustment === 'function') { 1717 adjustment = adjustment.apply(waypoint) 1718 } 1719 else if (typeof adjustment === 'string') { 1720 adjustment = parseFloat(adjustment) 1721 if (waypoint.options.offset.indexOf('%') > - 1) { 1722 adjustment = Math.ceil(axis.contextDimension * adjustment / 100) 1723 } 1724 } 1725 1726 contextModifier = axis.contextScroll - axis.contextOffset 1727 waypoint.triggerPoint = elementOffset + contextModifier - adjustment 1728 wasBeforeScroll = oldTriggerPoint < axis.oldScroll 1729 nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll 1730 triggeredBackward = wasBeforeScroll && nowAfterScroll 1731 triggeredForward = !wasBeforeScroll && !nowAfterScroll 1732 1733 if (!freshWaypoint && triggeredBackward) { 1734 waypoint.queueTrigger(axis.backward) 1735 triggeredGroups[waypoint.group.id] = waypoint.group 1736 } 1737 else if (!freshWaypoint && triggeredForward) { 1738 waypoint.queueTrigger(axis.forward) 1739 triggeredGroups[waypoint.group.id] = waypoint.group 1740 } 1741 else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) { 1742 waypoint.queueTrigger(axis.forward) 1743 triggeredGroups[waypoint.group.id] = waypoint.group 1744 } 1745 } 1746 } 1747 1748 Waypoint.requestAnimationFrame(function() { 1749 for (var groupKey in triggeredGroups) { 1750 triggeredGroups[groupKey].flushTriggers() 1751 } 1752 }) 1753 1754 return this 1755 } 1756 Context.findOrCreateByElement = function(element) { 1757 return Context.findByElement(element) || new Context(element) 1758 } 1759 Context.refreshAll = function() { 1760 for (var contextId in contexts) { 1761 contexts[contextId].refresh() 1762 } 1763 } 1764 Context.findByElement = function(element) { 1765 return contexts[element.waypointContextKey] 1766 } 1767 1768 window.onload = function() { 1769 if (oldWindowLoad) { 1770 oldWindowLoad() 1771 } 1772 Context.refreshAll() 1773 } 1774 1775 Waypoint.requestAnimationFrame = function(callback) { 1776 var requestFn = window.requestAnimationFrame || 1777 window.mozRequestAnimationFrame || 1778 window.webkitRequestAnimationFrame || 1779 requestAnimationFrameShim 1780 requestFn.call(window, callback) 1781 } 1782 Waypoint.Context = Context 1783}()) 1784;(function() { 1785 'use strict' 1786 1787 function byTriggerPoint(a, b) { 1788 return a.triggerPoint - b.triggerPoint 1789 } 1790 1791 function byReverseTriggerPoint(a, b) { 1792 return b.triggerPoint - a.triggerPoint 1793 } 1794 1795 var groups = { 1796 vertical: {}, 1797 horizontal: {} 1798 } 1799 var Waypoint = window.Waypoint 1800 function Group(options) { 1801 this.name = options.name 1802 this.axis = options.axis 1803 this.id = this.name + '-' + this.axis 1804 this.waypoints = [] 1805 this.clearTriggerQueues() 1806 groups[this.axis][this.name] = this 1807 } 1808 Group.prototype.add = function(waypoint) { 1809 this.waypoints.push(waypoint) 1810 } 1811 Group.prototype.clearTriggerQueues = function() { 1812 this.triggerQueues = { 1813 up: [], 1814 down: [], 1815 left: [], 1816 right: [] 1817 } 1818 } 1819 Group.prototype.flushTriggers = function() { 1820 for (var direction in this.triggerQueues) { 1821 var waypoints = this.triggerQueues[direction] 1822 var reverse = direction === 'up' || direction === 'left' 1823 waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint) 1824 for (var i = 0, end = waypoints.length; i < end; i += 1) { 1825 var waypoint = waypoints[i] 1826 if (waypoint.options.continuous || i === waypoints.length - 1) { 1827 waypoint.trigger([direction]) 1828 } 1829 } 1830 } 1831 this.clearTriggerQueues() 1832 } 1833 Group.prototype.next = function(waypoint) { 1834 this.waypoints.sort(byTriggerPoint) 1835 var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) 1836 var isLast = index === this.waypoints.length - 1 1837 return isLast ? null : this.waypoints[index + 1] 1838 } 1839 Group.prototype.previous = function(waypoint) { 1840 this.waypoints.sort(byTriggerPoint) 1841 var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) 1842 return index ? this.waypoints[index - 1] : null 1843 } 1844 Group.prototype.queueTrigger = function(waypoint, direction) { 1845 this.triggerQueues[direction].push(waypoint) 1846 } 1847 Group.prototype.remove = function(waypoint) { 1848 var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) 1849 if (index > -1) { 1850 this.waypoints.splice(index, 1) 1851 } 1852 } 1853 Group.prototype.first = function() { 1854 return this.waypoints[0] 1855 } 1856 Group.prototype.last = function() { 1857 return this.waypoints[this.waypoints.length - 1] 1858 } 1859 Group.findOrCreate = function(options) { 1860 return groups[options.axis][options.name] || new Group(options) 1861 } 1862 1863 Waypoint.Group = Group 1864}()) 1865;(function() { 1866 'use strict' 1867 1868 var $ = window.jQuery 1869 var Waypoint = window.Waypoint 1870 1871 function JQueryAdapter(element) { 1872 this.$element = $(element) 1873 } 1874 1875 $.each([
1876 'innerHeight', 1877 'innerWidth', 1878 'off', 1879 'offset', 1880 'on', 1881 'outerHeight', 1882 'outerWidth', 1883 'scrollLeft', 1884 'scrollTop' 1885 ], function(i, method) { 1886 JQueryAdapter.prototype[method] = function() { 1887 var args = Array.prototype.slice.call(arguments) 1888 return this.$element[method].apply(this.$element, args) 1889 } 1890 }) 1891 1892 $.each([ 1893 'extend', 1894 'inArray', 1895 'isEmptyObject' 1896 ], function(i, method) { 1897 JQueryAdapter[method] = $[method] 1898 }) 1899 1900 Waypoint.adapters.push({ 1901 name: 'jquery', 1902 Adapter: JQueryAdapter 1903 }) 1904 Waypoint.Adapter = JQueryAdapter 1905}()) 1906;(function() { 1907 'use strict' 1908 1909 var Waypoint = window.Waypoint 1910 1911 function createExtension(framework) { 1912 return function() { 1913 var waypoints = [] 1914 var overrides = arguments[0] 1915 1916 if (framework.isFunction(arguments[0])) { 1917 overrides = framework.extend({}, arguments[1]) 1918 overrides.handler = arguments[0] 1919 } 1920 1921 this.each(function() { 1922 var options = framework.extend({}, overrides, { 1923 element: this 1924 }) 1925 if (typeof options.context === 'string') { 1926 options.context = framework(this).closest(options.context)[0] 1927 } 1928 waypoints.push(new Waypoint(options)) 1929 }) 1930 1931 return waypoints 1932 } 1933 } 1934 1935 if (window.jQuery) { 1936 window.jQuery.fn.waypoint = createExtension(window.jQuery) 1937 } 1938 if (window.Zepto) { 1939 window.Zepto.fn.waypoint = createExtension(window.Zepto) 1940 } 1941}()) 1942;/** 1943 * vivus - JavaScript library to make drawing animation on SVG 1944 * @version v0.3.1 1945 * @link https://github.com/maxwellito/vivus 1946 * @license MIT 1947 */ 1948"use strict";!function(t,e){function r(r){if("undefined"==typeof r)throw new Error('Pathformer [constructor]: "element" parameter is required');if(r.constructor===String&&(r=e.getElementById(r),!r))throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID');if(!(r.constructor instanceof t.SVGElement||/^svg$/i.test(r.nodeName)))throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement');this.el=r,this.scan(r)}function n(t,e,r){this.isReady=!1,this.setElement(t,e),this.setOptions(e),this.setCallback(r),this.isReady&&this.init()}r.prototype.TYPES=["line","ellipse","circle","polygon","polyline","rect"],r.prototype.ATTR_WATCH=["cx","cy","points","r","rx","ry","x","x1","x2","y","y1","y2"],r.prototype.scan=function(t){for(var e,r,n,i,a=t.querySelectorAll(this.TYPES.join(",")),o=0;o<a.length;o++)r=a[o],e=this[r.tagName.toLowerCase()+"ToPath"],n=e(this.parseAttr(r.attributes)),i=this.pathMaker(r,n),r.parentNode.replaceChild(i,r)},r.prototype.lineToPath=function(t){var e={};return e.d="M"+t.x1+","+t.y1+"L"+t.x2+","+t.y2,e},r.prototype.rectToPath=function(t){var e={},r=parseFloat(t.x)||0,n=parseFloat(t.y)||0,i=parseFloat(t.width)||0,a=parseFloat(t.height)||0;return e.d="M"+r+" "+n+" ",e.d+="L"+(r+i)+" "+n+" ",e.d+="L"+(r+i)+" "+(n+a)+" ",e.d+="L"+r+" "+(n+a)+" Z",e},r.prototype.polylineToPath=function(t){var e,r,n={},i=t.points.trim().split(" ");if(-1===t.points.indexOf(",")){var a=[];for(e=0;e<i.length;e+=2)a.push(i[e]+","+i[e+1]);i=a}for(r="M"+i[0],e=1;e<i.length;e++)-1!==i[e].indexOf(",")&&(r+="L"+i[e]);return n.d=r,n},r.prototype.polygonToPath=function(t){var e=r.prototype.polylineToPath(t);return e.d+="Z",e},r.prototype.ellipseToPath=function(t){var e=t.cx-t.rx,r=t.cy,n=parseFloat(t.cx)+parseFloat(t.rx),i=t.cy,a={};return a.d="M"+e+","+r+"A"+t.rx+","+t.ry+" 0,1,1 "+n+","+i+"A"+t.rx+","+t.ry+" 0,1,1 "+e+","+i,a},r.prototype.circleToPath=function(t){var e={},r=t.cx-t.r,n=t.cy,i=parseFloat(t.cx)+parseFloat(t.r),a=t.cy;return e.d="M"+r+","+n+"A"+t.r+","+t.r+" 0,1,1 "+i+","+a+"A"+t.r+","+t.r+" 0,1,1 "+r+","+a,e},r.prototype.pathMaker=function(t,r){var n,i,a=e.createElementNS("http://www.w3.org/2000/svg","path");for(n=0;n<t.attributes.length;n++)i=t.attributes[n],-1===this.ATTR_WATCH.indexOf(i.name)&&a.setAttribute(i.name,i.value);for(n in r)a.setAttribute(n,r[n]);return a},r.prototype.parseAttr=function(t){for(var e,r={},n=0;n<t.length;n++){if(e=t[n],-1!==this.ATTR_WATCH.indexOf(e.name)&&-1!==e.value.indexOf("%"))throw new Error("Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into 'path' tags. Please use 'viewBox'.");r[e.name]=e.value}return r};var i,a,o;n.LINEAR=function(t){return t},n.EASE=function(t){return-Math.cos(t*Math.PI)/2+.5},n.EASE_OUT=function(t){return 1-Math.pow(1-t,3)},n.EASE_IN=function(t){return Math.pow(t,3)},n.EASE_OUT_BOUNCE=function(t){var e=-Math.cos(.5*t*Math.PI)+1,r=Math.pow(e,1.5),n=Math.pow(1-t,2),i=-Math.abs(Math.cos(2.5*r*Math.PI))+1;return 1-n+i*n},n.prototype.setElement=function(r,n){if("undefined"==typeof r)throw new Error('Vivus [constructor]: "element" parameter is required');if(r.constructor===String&&(r=e.getElementById(r),!r))throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID');if(this.parentEl=r,n&&n.file){var i=e.createElement("object");i.setAttribute("type","image/svg+xml"),i.setAttribute("data",n.file),i.setAttribute("built-by-vivus","true"),r.appendChild(i),r=i}switch(r.constructor){case t.SVGSVGElement:case t.SVGElement:this.el=r,this.isReady=!0;break;case t.HTMLObjectElement:var a,o;o=this,a=function(t){if(!o.isReady){if(o.el=r.contentDocument&&r.contentDocument.querySelector("svg"),!o.el&&t)throw new Error("Vivus [constructor]: object loaded does not contain any SVG");return o.el?(r.getAttribute("built-by-vivus")&&(o.parentEl.insertBefore(o.el,r),o.parentEl.removeChild(r),o.el.setAttribute("width","100%"),o.el.setAttribute("height","100%")),o.isReady=!0,o.init(),!0):void 0}},a()||r.addEventListener("load",a);break;default:throw new Error('Vivus [constructor]: "element" parameter is not val
1948id (or miss the "file" attribute)')}},n.prototype.setOptions=function(e){var r=["delayed","async","oneByOne","scenario","scenario-sync"],i=["inViewport","manual","autostart"];if(void 0!==e&&e.constructor!==Object)throw new Error('Vivus [constructor]: "options" parameter must be an object');if(e=e||{},e.type&&-1===r.indexOf(e.type))throw new Error("Vivus [constructor]: "+e.type+" is not an existing animation `type`");if(this.type=e.type||r[0],e.start&&-1===i.indexOf(e.start))throw new Error("Vivus [constructor]: "+e.start+" is not an existing `start` option");if(this.start=e.start||i[0],this.isIE=-1!==t.navigator.userAgent.indexOf("MSIE")||-1!==t.navigator.userAgent.indexOf("Trident/")||-1!==t.navigator.userAgent.indexOf("Edge/"),this.duration=o(e.duration,120),this.delay=o(e.delay,null),this.dashGap=o(e.dashGap,1),this.forceRender=e.hasOwnProperty("forceRender")?!!e.forceRender:this.isIE,this.selfDestroy=!!e.selfDestroy,this.onReady=e.onReady,this.frameLength=this.currentFrame=this.map=this.delayUnit=this.speed=this.handle=null,this.ignoreInvisible=e.hasOwnProperty("ignoreInvisible")?!!e.ignoreInvisible:!1,this.animTimingFunction=e.animTimingFunction||n.LINEAR,this.pathTimingFunction=e.pathTimingFunction||n.LINEAR,this.delay>=this.duration)throw new Error("Vivus [constructor]: delay must be shorter than duration")},n.prototype.setCallback=function(t){if(t&&t.constructor!==Function)throw new Error('Vivus [constructor]: "callback" parameter must be a function');this.callback=t||function(){}},n.prototype.mapping=function(){var e,r,n,i,a,s,h,u;for(u=s=h=0,r=this.el.querySelectorAll("path"),e=0;e<r.length;e++)n=r[e],this.isInvisible(n)||(a={el:n,length:Math.ceil(n.getTotalLength())},isNaN(a.length)?t.console&&console.warn&&console.warn("Vivus [mapping]: cannot retrieve a path element length",n):(this.map.push(a),n.style.strokeDasharray=a.length+" "+(a.length+2*this.dashGap),n.style.strokeDashoffset=a.length+this.dashGap,a.length+=this.dashGap,s+=a.length,this.renderPath(e)));for(s=0===s?1:s,this.delay=null===this.delay?this.duration/3:this.delay,this.delayUnit=this.delay/(r.length>1?r.length-1:1),e=0;e<this.map.length;e++){switch(a=this.map[e],this.type){case"delayed":a.startAt=this.delayUnit*e,a.duration=this.duration-this.delay;break;case"oneByOne":a.startAt=h/s*this.duration,a.duration=a.length/s*this.duration;break;case"async":a.startAt=0,a.duration=this.duration;break;case"scenario-sync":n=a.el,i=this.parseAttr(n),a.startAt=u+(o(i["data-delay"],this.delayUnit)||0),a.duration=o(i["data-duration"],this.duration),u=void 0!==i["data-async"]?a.startAt:a.startAt+a.duration,this.frameLength=Math.max(this.frameLength,a.startAt+a.duration);break;case"scenario":n=a.el,i=this.parseAttr(n),a.startAt=o(i["data-start"],this.delayUnit)||0,a.duration=o(i["data-duration"],this.duration),this.frameLength=Math.max(this.frameLength,a.startAt+a.duration)}h+=a.length,this.frameLength=this.frameLength||this.duration}},n.prototype.drawer=function(){var t=this;this.currentFrame+=this.speed,this.currentFrame<=0?(this.stop(),this.reset(),this.callback(this)):this.currentFrame>=this.frameLength?(this.stop(),this.currentFrame=this.frameLength,this.trace(),this.selfDestroy&&this.destroy(),this.callback(this)):(this.trace(),this.handle=i(function(){t.drawer()}))},n.prototype.trace=function(){var t,e,r,n;for(n=this.animTimingFunction(this.currentFrame/this.frameLength)*this.frameLength,t=0;t<this.map.length;t++)r=this.map[t],e=(n-r.startAt)/r.duration,e=this.pathTimingFunction(Math.max(0,Math.min(1,e))),r.progress!==e&&(r.progress=e,r.el.style.strokeDashoffset=Math.floor(r.length*(1-e)),this.renderPath(t))},n.prototype.renderPath=function(t){if(this.forceRender&&this.map&&this.map[t]){var e=this.map[t],r=e.el.cloneNode(!0);e.el.parentNode.replaceChild(r,e.el),e.el=r}},n.prototype.init=function(){this.frameLength=0,this.currentFrame=0,this.map=[],new r(this.el),this.mapping(),this.starter(),this.onReady&&this.onReady(this)},n.prototype.starter=function(){switch(this.start){case"manual":return;case"autostart":this.play();break;case"inViewport":var e=this,r=function(){e.isInViewport(e.parentEl,1)&&(e.play(),t.removeEventListener("scroll",r))};t.addEventListener("scroll",r),r()}},n.prototype.getStatus=function(){return 0===this.currentFrame?"start":this.currentFrame===this.frameLength?"end":"progress"},n.prototype.reset=function(){return this.setFrameProgress(0)},n.prototype.finish=function(){return this.setFrameProgress(1)},n.prototype.setFrameProgress=function(t){return t=Math.min(1,Math.max(0,t)),this.currentFrame=Math.round(this.frameLength*t),this.trace(),this},n.prototype.play=function(t){if(t&&"number"!=typeof t)throw new Error("Vivus [play]: invali
1948d speed");return this.speed=t||1,this.handle||this.drawer(),this},n.prototype.stop=function(){return this.handle&&(a(this.handle),this.handle=null),this},n.prototype.destroy=function(){this.stop();var t,e;for(t=0;t<this.map.length;t++)e=this.map[t],e.el.style.strokeDashoffset=null,e.el.style.strokeDasharray=null,this.renderPath(t)},n.prototype.isInvisible=function(t){var e,r=t.getAttribute("data-ignore");return null!==r?"false"!==r:this.ignoreInvisible?(e=t.getBoundingClientRect(),!e.width&&!e.height):!1},n.prototype.parseAttr=function(t){var e,r={};if(t&&t.attributes)for(var n=0;n<t.attributes.length;n++)e=t.attributes[n],r[e.name]=e.value;return r},n.prototype.isInViewport=function(t,e){var r=this.scrollY(),n=r+this.getViewportH(),i=t.getBoundingClientRect(),a=i.height,o=r+i.top,s=o+a;return e=e||0,n>=o+a*e&&s>=r},n.prototype.docElem=t.document.documentElement,n.prototype.getViewportH=function(){var e=this.docElem.clientHeight,r=t.innerHeight;return r>e?r:e},n.prototype.scrollY=function(){return t.pageYOffset||this.docElem.scrollTop},i=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),a=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||t.msCancelAnimationFrame||function(e){return t.clearTimeout(e)}}(),o=function(t,e){var r=parseInt(t,10);return r>=0?r:e},"function"==typeof define&&define.amd?define([],function(){return n}):"object"==typeof exports?module.exports=n:t.Vivus=n}(window,document);/*global jQuery */ 1949/*! 1950* FitText.js 1.2 1951* 1952* Copyright 2011, Dave Rupert http://daverupert.com 1953* Released under the WTFPL license 1954* http://sam.zoy.org/wtfpl/ 1955* 1956* Date: Thu May 05 14:23:00 2011 -0600 1957*/ 1958 1959(function( $ ){ 1960 1961 $.fn.fitText = function( kompressor, options ) { 1962 var compressor = kompressor || 1, 1963 settings = $.extend({ 1964 'minFontSize' : Number.NEGATIVE_INFINITY, 1965 'maxFontSize' : Number.POSITIVE_INFINITY 1966 }, options); 1967 1968 return this.each(function(){ 1969 var $this = $(this); 1970 var resizer = function () { 1971 $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize))); 1972 }; 1973 resizer(); 1974 $(window).on('resize.fittext orientationchange.fittext', resizer); 1975 1976 }); 1977 1978 }; 1979 1980})( jQuery );var czrapp = czrapp || {}; 1981(function($, czrapp) { 1982 czrapp._printLog = function( log ) { 1983 var _render = function() { 1984 return $.Deferred( function() { 1985 var dfd = this; 1986 $.when( $('#footer').before( $('<div/>', { id : "bulklog" }) ) ).done( function() { 1987 $('#bulklog').css({ 1988 position: 'fixed', 1989 'z-index': '99999', 1990 'font-size': '0.8em', 1991 color: '#000', 1992 padding: '5%', 1993 width: '90%', 1994 height: '20%', 1995 overflow: 'hidden', 1996 bottom: '0', 1997 left: '0', 1998 background: 'yellow' 1999 }); 2000 2001 dfd.resolve(); 2002 }); 2003 }).promise(); 2004 }, 2005 _print = function() { 2006 $('#bulklog').prepend('<p>' + czrapp._prettyfy( { consoleArguments : [ log ], prettyfy : false } ) + '</p>'); 2007 }; 2008 2009 if ( 1 != $('#bulk-log').length ) { 2010 _render().done( _print ); 2011 } else { 2012 _print(); 2013 } 2014 }; 2015 2016 2017 czrapp._truncate = function( string , length ){ 2018 length = length || 150; 2019 if ( ! _.isString( string ) ) 2020 return ''; 2021 return string.length > length ? string.substr( 0, length - 1 ) : string; 2022 }; 2023 var _prettyPrintLog = function( args ) { 2024 var _defaults = { 2025 bgCol : '#5ed1f5', 2026 textCol : '#000', 2027 consoleArguments : [] 2028 }; 2029 args = _.extend( _defaults, args ); 2030 2031 var _toArr = Array.from( args.consoleArguments ), 2032 _truncate = function( string ){ 2033 if ( ! _.isString( string ) ) 2034 return ''; 2035 return string.length > 300 ? string.substr( 0, 299 ) + '...' : string; 2036 }; 2037 if ( ! _.isEmpty( _.filter( _toArr, function( it ) { return ! _.isString( it ); } ) ) ) { 2038 _toArr = JSON.stringify( _toArr.join(' ') ); 2039 } else { 2040 _toArr = _toArr.join(' '); 2041 } 2042 return [ 2043 '%c ' + _truncate( _toArr ), 2044 [ 'background:' + args.bgCol, 'color:' + args.textCol, 'display: block;' ].join(';') 2045 ]; 2046 }; 2047 2048 var _wrapLogInsideTags = function( title, msg, bgColor ) { 2049 if ( ( _.isUndefined( console ) && typeof window.console.log != 'function' ) ) 2050 return; 2051 if ( czrapp.localized.isDevMode ) { 2052 if ( _.isUndefined( msg ) ) { 2053 console.log.apply( console, _prettyPrintLog( { bgCol : bgColor, textCol : '#000', consoleArguments : [ '<' + title + '>' ] } ) ); 2054 } else { 2055 console.log.apply( console, _prettyPrintLog( { bgCol : bgColor, textCol : '#000', consoleArguments : [ '<' + title + '>' ] } ) ); 2056 console.log( msg ); 2057 console.log.apply( console, _prettyPrintLog( { bgCol : bgColor, textCol : '#000', consoleArguments : [ '</' + title + '>' ] } ) ); 2058 } 2059 } else { 2060 console.log.apply( console, _prettyPrintLog( { bgCol : bgColor, textCol : '#000', consoleArguments : [ title ] } ) ); 2061 } 2062 }; 2063 czrapp.consoleLog = function() {
2064 if ( ! czrapp.localized.isDevMode ) 2065 return; 2066 if ( ( _.isUndefined( console ) && typeof window.console.log != 'function' ) ) 2067 return; 2068 console.log.apply( console, _prettyPrintLog( { consoleArguments : arguments } ) ); 2069 console.log( 'Unstyled console message : ', arguments ); 2070 }; 2071 2072 czrapp.errorLog = function() { 2073 if ( ( _.isUndefined( console ) && typeof window.console.log != 'function' ) ) 2074 return; 2075 2076 console.log.apply( console, _prettyPrintLog( { bgCol : '#ffd5a0', textCol : '#000', consoleArguments : arguments } ) ); 2077 }; 2078 2079 2080 czrapp.errare = function( title, msg ) { _wrapLogInsideTags( title, msg, '#ffd5a0' ); }; 2081 czrapp.infoLog = function( title, msg ) { _wrapLogInsideTags( title, msg, '#5ed1f5' ); }; 2082 czrapp.doAjax = function( queryParams ) { 2083 queryParams = queryParams || ( _.isObject( queryParams ) ? queryParams : {} ); 2084 2085 var ajaxUrl = queryParams.ajaxUrl || czrapp.localized.ajaxUrl,//the ajaxUrl can be specified when invoking doAjax 2086 nonce = czrapp.localized.frontNonce,//{ 'id' => 'HuFrontNonce', 'handle' => wp_create_nonce( 'hu-front-nonce' ) }, 2087 dfd = $.Deferred(), 2088 _query_ = _.extend( { 2089 action : '', 2090 withNonce : false 2091 }, 2092 queryParams 2093 ); 2094 if ( "https:" == document.location.protocol ) { 2095 ajaxUrl = ajaxUrl.replace( "http://", "https://" ); 2096 } 2097 if ( _.isEmpty( _query_.action ) || ! _.isString( _query_.action ) ) { 2098 czrapp.errorLog( 'czrapp.doAjax : unproper action provided' ); 2099 return dfd.resolve().promise(); 2100 } 2101 _query_[ nonce.id ] = nonce.handle; 2102 if ( ! _.isObject( nonce ) || _.isUndefined( nonce.id ) || _.isUndefined( nonce.handle ) ) { 2103 czrapp.errorLog( 'czrapp.doAjax : unproper nonce' ); 2104 return dfd.resolve().promise(); 2105 } 2106 2107 $.post( ajaxUrl, _query_ ) 2108 .done( function( _r ) { 2109 if ( '0' === _r || '-1' === _r || false === _r.success ) { 2110 czrapp.errare( 'czrapp.doAjax : done ajax error for action : ' + _query_.action , _r ); 2111 dfd.reject( _r ); 2112 } 2113 dfd.resolve( _r ); 2114 }) 2115 .fail( function( _r ) { 2116 czrapp.errare( 'czrapp.doAjax : failed ajax error for : ' + _query_.action, _r ); 2117 dfd.reject( _r ); 2118 }); 2119 return dfd.promise(); 2120 }; 2121})(jQuery, czrapp); 2122(function($, czrapp) { 2123 czrapp.isKeydownButNotEnterEvent = function ( event ) { 2124 return ( 'keydown' === event.type && 13 !== event.which ); 2125 }; 2126 czrapp.setupDOMListeners = function( event_map , args, instance ) { 2127 var _defaultArgs = { 2128 model : {}, 2129 dom_el : {} 2130 }; 2131 2132 if ( _.isUndefined( instance ) || ! _.isObject( instance ) ) { 2133 czrapp.errorLog( 'setupDomListeners : instance should be an object', args ); 2134 return; 2135 } 2136 if ( ! _.isArray( event_map ) ) { 2137 czrapp.errorLog( 'setupDomListeners : event_map should be an array', args ); 2138 return; 2139 } 2140 if ( ! _.isObject( args ) ) { 2141 czrapp.errorLog( 'setupDomListeners : args should be an object', event_map ); 2142 return; 2143 } 2144 2145 args = _.extend( _defaultArgs, args ); 2146 if ( ! ( args.dom_el instanceof jQuery ) || 1 != args.dom_el.length ) { 2147 czrapp.errorLog( 'setupDomListeners : dom element should be an existing dom element', args ); 2148 return; 2149 } 2150 _.map( event_map , function( _event ) { 2151 if ( ! _.isString( _event.selector ) || _.isEmpty( _event.selector ) ) { 2152 czrapp.errorLog( 'setupDOMListeners : selector must be a string not empty. Aborting setup of action(s) : ' + _event.actions.join(',') ); 2153 return; 2154 } 2155 if ( ! _.isString( _event.selector ) || _.isEmpty( _event.selector ) ) { 2156 czrapp.errorLog( 'setupDOMListeners : selector must be a string not empty. Aborting setup of action(s) : ' + _event.actions.join(',') ); 2157 return; 2158 } 2159 var once = _event.once ? _event.once : false; 2160 args.dom_el[ once ? 'one' : 'on' ]( _event.trigger , _event.selector, function( e, event_params ) { 2161 e.stopPropagation(); 2162 if ( czrapp.isKeydownButNotEnterEvent( e ) ) { 2163 return; 2164 } 2165 e.preventDefault(); // Keep this AFTER the key filter above 2166 var actionsParams = $.extend( true, {}, args ); 2167 if ( _.has( actionsParams, 'model') && _.has( actionsParams.model, 'id') ) { 2168 if ( _.has( instance, 'get' ) ) 2169 actionsParams.model = instance(); 2170 else 2171 actionsParams.model = instance.getModel( actionsParams.model.id ); 2172 } 2173 $.extend( actionsParams, { event : _event, dom_event : e } ); 2174 $.extend( actionsParams, event_params ); 2175 if ( ! _.has( actionsParams, 'event' ) || ! _.has( actionsParams.event, 'actions' ) ) { 2176 czrapp.errorLog( 'executeEventActionChain : missing obj.event or obj.event.actions' ); 2177 return; 2178 } 2179 try { czrapp.executeEventActionChain( actionsParams, instance ); } catch( er ) { 2180 czrapp.errorLog( 'In setupDOMListeners : problem when trying to fire actions : ' + actionsParams.event.actions ); 2181 czrapp.errorLog( 'Error : ' + er ); 2182 } 2183 });//.on() 2184 });//_.map() 2185 };//setupDomListeners 2186 czrapp.executeEventActionChain = function( args, instance ) { 2187 if ( 'function' === typeof( args.event.actions ) ) 2188 return args.event.actions.call( instance, args ); 2189 if ( ! _.isArray( args.event.actions ) ) 2190 args.event.actions = [ args.event.actions ]; 2191 var _break = false; 2192 _.map( args.event.actions, function( _cb ) { 2193 if ( _break ) 2194 return; 2195 2196 if ( 'function' != typeof( instance[ _cb ] ) ) { 2197 throw new Error( 'executeEventActionChain : the action : ' + _cb + ' has not been found when firing event : ' + args.event.selector ); 2198 } 2199 var $_dom_el = ( _.has(args, 'dom_el') && -1 != args.dom_el.length ) ? args.dom_el : false; 2200 if ( ! $_dom_el ) { 2201 czrapp.errorLog( 'missing dom element'); 2202 return; 2203 } 2204 $_dom_el.trigger( 'before_' + _cb, _.omit( args, 'event' ) ); 2205 var _cb_return = instance[ _cb ].call( instance, args ); 2206 if ( false === _cb_return ) 2207 _break = true; 2208 $_dom_el.trigger( 'after_' + _cb, _.omit( args, 'event' ) ); 2209 });//_.map 2210 }; 2211})(jQuery, czrapp);var czrapp = czrapp || {}; 2212czrapp.methods = {}; 2213 2214(function( $ ){ 2215 var ctor, inherits, slice = Array.prototype.slice; 2216 ctor = function() {}; 2217 inherits = function( parent, protoProps, staticProps ) { 2218 var child; 2219 if ( protoProps && protoProps.hasOwnProperty( 'constructor' ) ) { 2220 child = protoProps.constructor; 2221 } else { 2222 child = function() { 2223 var result = parent.apply( this, arguments ); 2224 return result; 2225 }; 2226 } 2227 $.extend( child, parent ); 2228 ctor.prototype = parent.prototype; 2229 child.prototype = new ctor(); 2230 if ( protoProps ) 2231 $.extend( child.prototype, protoProps ); 2232 if ( staticProps ) 2233 $.extend( child, staticProps ); 2234 child.prototype.constructor = child; 2235 child.__super__ = parent.prototype; 2236 2237 return child; 2238 }; 2239 czrapp.Class = function( applicator, argsArray, options ) { 2240 var magic, args = arguments; 2241 2242 if ( applicator && argsArray && czrapp.Class.applicator === applicator ) { 2243 args = argsArray; 2244 $.extend( this, options || {} ); 2245 } 2246 2247 magic = this; 2248 if ( this.instance ) { 2249 magic = function() { 2250 return magic.instance.apply( magic, arguments ); 2251 }; 2252 2253 $.extend( magic, this ); 2254 } 2255 2256 magic.initialize.apply( magic, args ); 2257 return magic; 2258 }; 2259 czrapp.Class.extend = function( protoProps, classProps ) { 2260 var child = inherits( this, protoProps, classProps ); 2261 child.extend = this.extend; 2262 return child; 2263 }; 2264 2265 czrapp.Class.applicator = {}; 2266 czrapp.Class.prototype.initialize = function() {}; 2267 czrapp.Class.prototype.extended = function( constructor ) { 2268 var proto = this; 2269 2270 while ( typeof proto.constructor !== 'undefined' ) { 2271 if ( proto.constructor === constructor ) 2272 return true; 2273 if ( typeof proto.constructor.__super__ === 'undefined' ) 2274 return false; 2275 proto = proto.constructor.__super__; 2276 } 2277 return false; 2278 }; 2279 czrapp.Events = { 2280 trigger: function( id ) { 2281 if ( this.topics && this.topics[ id ] ) 2282 this.topics[ id ].fireWith( this, slice.call( arguments, 1 ) ); 2283 return this; 2284 }, 2285 2286 bind: function( id ) { 2287 this.topics = this.topics || {}; 2288 this.topics[ id ] = this.topics[ id ] || $.Callbacks(); 2289 this.topics[ id ].add.apply( this.topics[ id ], slice.call( arguments, 1 ) ); 2290 return this; 2291 }, 2292 2293 unbind: function( id ) { 2294 if ( this.topics && this.topics[ id ] ) 2295 this.topics[ id ].remove.apply( this.topics[ id ], slice.call( arguments, 1 ) ); 2296 return this; 2297 } 2298 }; 2299 czrapp.Value = czrapp.Class.extend({ 2300 initialize: function( initial, options ) { 2301 this._value = initial; // @todo: potentially change this to a this.set() call. 2302 this.callbacks = $.Callbacks(); 2303 this._dirty = false; 2304 2305 $.extend( this, options || {} ); 2306 2307 this.set = $.proxy( this.set, this ); 2308 }, 2309 instance: function() { 2310 return arguments.length ? this.set.apply( this, arguments ) : this.get(); 2311 }, 2312 get: function() { 2313 return this._value; 2314 }, 2315 set: function( to, o ) { 2316 var from = this._value, dfd = $.Deferred(), self = this, _promises = []; 2317 2318 to = this._setter.apply( this, arguments ); 2319 to = this.validate( to ); 2320 var args = _.extend( { silent : false }, _.isObject( o ) ? o : {} ); 2321 if ( null === to || _.isEqual( from, to ) ) { 2322 return dfd.resolveWith( self, [ to, from, o ] ).promise(); 2323 } 2324 2325 this._value = to; 2326 this._dirty = true; 2327 if ( true === args.silent ) { 2328 return dfd.resolveWith( self, [ to, from, o ] ).promise(); 2329 } 2330 2331 if ( this._deferreds ) { 2332 _.each( self._deferreds, function( _prom ) { 2333 _promises.push( _prom.apply( null, [ to, from, o ] ) ); 2334 }); 2335 2336 $.when.apply( null, _promises ) 2337 .fail( function() { czrapp.errorLog( 'A deferred callback failed in api.Value::set()'); }) 2338 .then( function() { 2339 self.callbacks.fireWith( self, [ to, from, o ] ); 2340 dfd.resolveWith( self, [ to, from, o ] ); 2341 }); 2342 } else { 2343 this.callbacks.fireWith( this, [ to, from, o ] ); 2344 return dfd.resolveWith( self, [ to, from, o ] ).promise( self ); 2345 } 2346 return dfd.promise( self ); 2347 }, 2348 silent_set : function( to, dirtyness ) { 2349 var from = this._value; 2350 2351 to = this._setter.apply( this, arguments ); 2352 to = this.validate( to ); 2353 if ( null === to || _.isEqual( from, to ) ) { 2354 return this; 2355 } 2356 2357 this._value = to; 2358 this._dirty = ( _.isUndefined( dirtyness ) || ! _.isBoolean( dirtyness ) ) ? this._dirty : dirtyness; 2359 2360 this.callbacks.fireWith( this, [ to, from, { silent : true } ] ); 2361 2362 return this; 2363 }, 2364 2365 _setter: function( to ) { 2366 return to; 2367 }, 2368 2369 setter: function( callback ) { 2370 var from = this.get(); 2371 this._setter = callback; 2372 this._value = null; 2373 this.set( from ); 2374 return this; 2375 }, 2376 2377 resetSetter: function() { 2378 this._setter = this.constructor.prototype._setter; 2379 this.set( this.get() ); 2380 return this; 2381 }, 2382 2383 validate: function( value ) { 2384 return value; 2385 }, 2386 bind: function() { 2387 var self = this, 2388 _isDeferred = false, 2389 _cbs = []; 2390 2391 $.each( arguments, function( _key, _arg ) { 2392 if ( ! _isDeferred ) 2393 _isDeferred = _.isObject( _arg ) && _arg.deferred; 2394 if ( _.isFunction( _arg ) ) 2395 _cbs.push( _arg ); 2396 }); 2397 2398 if ( _isDeferred ) { 2399 self._deferreds = self._deferreds || []; 2400 _.each( _cbs, function( _cb ) { 2401 if ( ! _.contains( _cb, self._deferreds ) ) 2402 self._deferreds.push( _cb ); 2403 }); 2404 } else { 2405 self.callbacks.add.apply( self.callbacks, arguments ); 2406 } 2407 return this; 2408 }, 2409 unbind: function() { 2410 this.callbacks.remove.apply( this.callbacks, arguments ); 2411 return this; 2412 }, 2413 }); 2414 czrapp.Values = czrapp.Class.extend({
2415 defaultConstructor: czrapp.Value, 2416 2417 initialize: function( options ) { 2418 $.extend( this, options || {} ); 2419 2420 this._value = {}; 2421 this._deferreds = {}; 2422 }, 2423 instance: function( id ) { 2424 if ( arguments.length === 1 ) 2425 return this.value( id ); 2426 2427 return this.when.apply( this, arguments ); 2428 }, 2429 value: function( id ) { 2430 return this._value[ id ]; 2431 }, 2432 has: function( id ) { 2433 return typeof this._value[ id ] !== 'undefined'; 2434 }, 2435 add: function( id, value ) { 2436 if ( this.has( id ) ) 2437 return this.value( id ); 2438 2439 this._value[ id ] = value; 2440 value.parent = this; 2441 if ( value.extended( czrapp.Value ) ) 2442 value.bind( this._change ); 2443 2444 this.trigger( 'add', value ); 2445 if ( this._deferreds[ id ] ) 2446 this._deferreds[ id ].resolve(); 2447 2448 return this._value[ id ]; 2449 }, 2450 create: function( id ) { 2451 return this.add( id, new this.defaultConstructor( czrapp.Class.applicator, slice.call( arguments, 1 ) ) ); 2452 }, 2453 each: function( callback, context ) { 2454 context = typeof context === 'undefined' ? this : context; 2455 2456 $.each( this._value, function( key, obj ) { 2457 callback.call( context, obj, key ); 2458 }); 2459 }, 2460 remove: function( id ) { 2461 var value; 2462 2463 if ( this.has( id ) ) { 2464 value = this.value( id ); 2465 this.trigger( 'remove', value ); 2466 if ( value.extended( czrapp.Value ) ) 2467 value.unbind( this._change ); 2468 delete value.parent; 2469 } 2470 2471 delete this._value[ id ]; 2472 delete this._deferreds[ id ]; 2473 }, 2474 when: function() { 2475 var self = this, 2476 ids = slice.call( arguments ), 2477 dfd = $.Deferred(); 2478 if ( $.isFunction( ids[ ids.length - 1 ] ) ) 2479 dfd.done( ids.pop() ); 2480 $.when.apply( $, $.map( ids, function( id ) { 2481 if ( self.has( id ) ) 2482 return; 2483 return self._deferreds[ id ] || $.Deferred(); 2484 })).done( function() { 2485 var values = $.map( ids, function( id ) { 2486 return self( id ); 2487 }); 2488 if ( values.length !== ids.length ) { 2489 self.when.apply( self, ids ).done( function() { 2490 dfd.resolveWith( self, values ); 2491 }); 2492 return; 2493 } 2494 2495 dfd.resolveWith( self, values ); 2496 }); 2497 2498 return dfd.promise(); 2499 }, 2500 _change: function() { 2501 this.parent.trigger( 'change', this ); 2502 } 2503 }); 2504 $.extend( czrapp.Values.prototype, czrapp.Events ); 2505 2506})( jQuery );//@global HUParams 2507var czrapp = czrapp || {}; 2508(function($, czrapp) { 2509 czrapp.localized = HUParams || {}; 2510 2511 var _methods = { 2512 cacheProp : function() { 2513 var self = this; 2514 $.extend( czrapp, { 2515 $_window : $(window), 2516 $_html : $('html'), 2517 $_body : $('body'), 2518 $_header : $('#header'), 2519 $_wpadminbar : $('#wpadminbar'), 2520 $_mainWrapper : $('.main', '#wrapper'), 2521 $_mainContent : $('.main', '#wrapper').find('.content'), 2522 is_responsive : self.isResponsive(),//store the initial responsive state of the window 2523 current_device : self.getDevice()//store the initial device 2524 }); 2525 }, 2526 isResponsive : function() { 2527 return this.matchMedia(979); 2528 }, 2529 getDevice : function() { 2530 var _devices = { 2531 desktop : 979, 2532 tablet : 767, 2533 smartphone : 480 2534 }, 2535 _current_device = 'desktop', 2536 that = this; 2537 2538 2539 _.map( _devices, function( max_width, _dev ){ 2540 if ( that.matchMedia( max_width ) ) 2541 _current_device = _dev; 2542 } ); 2543 2544 return _current_device; 2545 }, 2546 2547 matchMedia : function( _maxWidth ) { 2548 if ( window.matchMedia ) 2549 return ( window.matchMedia("(max-width: "+_maxWidth+"px)").matches ); 2550 $_window = czrapp.$_window || $(window); 2551 return $_window.width() <= ( _maxWidth - 15 ); 2552 }, 2553 2554 emit : function( cbs, args ) { 2555 cbs = _.isArray(cbs) ? cbs : [cbs]; 2556 var self = this; 2557 _.map( cbs, function(cb) { 2558 if ( 'function' == typeof(self[cb]) ) { 2559 args = 'undefined' == typeof( args ) ? Array() : args ; 2560 self[cb].apply(self, args ); 2561 czrapp.trigger( cb, _.object( _.keys(args), args ) ); 2562 } 2563 });//_.map 2564 }, 2565 2566 triggerSimpleLoad : function( $_imgs ) { 2567 if ( 0 === $_imgs.length ) 2568 return; 2569 2570 $_imgs.map( function( _ind, _img ) { 2571 $(_img).load( function () { 2572 $(_img).trigger('simple_load'); 2573 });//end load 2574 if ( $(_img)[0] && $(_img)[0].complete ) 2575 $(_img).load(); 2576 } );//end map 2577 },//end of fn 2578 2579 isUserLogged : function() { 2580 return czrapp.$_body.hasClass('logged-in') || 0 !== czrapp.$_wpadminbar.length; 2581 }, 2582 2583 isSelectorAllowed : function( $_el, skip_selectors, requested_sel_type ) { 2584 var sel_type = 'ids' == requested_sel_type ? 'id' : 'class', 2585 _selsToSkip = skip_selectors[requested_sel_type]; 2586 if ( 'object' != typeof(skip_selectors) || ! skip_selectors[requested_sel_type] || ! $.isArray( skip_selectors[requested_sel_type] ) || 0 === skip_selectors[requested_sel_type].length ) 2587 return true; 2588 if ( $_el.parents( _selsToSkip.map( function( _sel ){ return 'id' == sel_type ? '#' + _sel : '.' + _sel; } ).join(',') ).length > 0 ) 2589 return false; 2590 if ( ! $_el.attr( sel_type ) ) 2591 return true; 2592 2593 var _elSels = $_el.attr( sel_type ).split(' '), 2594 _filtered = _elSels.filter( function(classe) { return -1 != $.inArray( classe , _selsToSkip ) ;}); 2595 return 0 === _filtered.length; 2596 }, 2597 _isMobileScreenSize : function() { 2598 return ( _.isFunction( window.matchMedia ) && matchMedia( 'only screen and (max-width: 720px)' ).matches ) || ( this._isCustomizing() && 'desktop' != this.previewDevice() ); 2599 }, 2600 _isCustomizing : function() { 2601 return czrapp.$_body.hasClass('is-customizing') || ( 'undefined' !== typeof wp && 'undefined' !== typeof wp.customize ); 2602 }, 2603 _has_iframe : function ( $_elements ) { 2604 var that = this, 2605 to_return = []; 2606 _.each( $_elements, function( $_el, container ){ 2607 if ( $_el.length > 0 && $_el.find('IFRAME').length > 0 ) 2608 to_return.push(container); 2609 }); 2610 return to_return; 2611 }, 2612 };//_methods{} 2613
2614 czrapp.methods.Base = czrapp.methods.Base || {}; 2615 $.extend( czrapp.methods.Base , _methods );//$.extend 2616 2617})(jQuery, czrapp);/*************************** 2618* ADD BROWSER DETECT METHODS 2619****************************/ 2620(function($, czrapp) { 2621 var _methods = { 2622 addBrowserClassToBody : function() { 2623 if ( $.browser.chrome ) 2624 czrapp.$_body.addClass("chrome"); 2625 else if ( $.browser.webkit ) 2626 czrapp.$_body.addClass("safari"); 2627 if ( $.browser.mozilla ) 2628 czrapp.$_body.addClass("mozilla"); 2629 else if ( $.browser.msie || '8.0' === $.browser.version || '9.0' === $.browser.version || '10.0' === $.browser.version || '11.0' === $.browser.version ) 2630 czrapp.$_body.addClass("ie").addClass("ie" + $.browser.version.replace(/[.0]/g, '')); 2631 if ( czrapp.$_body.hasClass("ie") ) 2632 czrapp.$_body.addClass($.browser.version); 2633 } 2634 };//_methods{} 2635 czrapp.methods.BrowserDetect = czrapp.methods.BrowserDetect || {}; 2636 $.extend( czrapp.methods.BrowserDetect , _methods ); 2637 2638})(jQuery, czrapp); 2639var czrapp = czrapp || {}; 2640(function( $, czrapp ) { 2641 var _methods = { 2642 imgSmartLoad : function() { 2643 var smartLoadEnabled = 1 == HUParams.imgSmartLoadEnabled, 2644 _where = HUParams.imgSmartLoadOpts.parentSelectors.join(); 2645 if ( smartLoadEnabled ) { 2646 $( _where ).imgSmartLoad( 2647 _.size( HUParams.imgSmartLoadOpts.opts ) > 0 ? HUParams.imgSmartLoadOpts.opts : {} 2648 ); 2649 } 2650 if ( 1 == HUParams.centerAllImg ) { 2651 var self = this, 2652 $_to_center = smartLoadEnabled ? 2653 $( _.filter( $( _where ).find('img'), function( img ) { 2654 return $(img).is(HUParams.imgSmartLoadOpts.opts.excludeImg.join()); 2655 }) ): //filter 2656 $( _where ).find('img'); 2657 $_to_center_with_delay = $( _.filter( $_to_center, function( img ) { 2658 return $(img).hasClass('tc-holder-img'); 2659 }) ); 2660 setTimeout( function(){ 2661 self.triggerSimpleLoad( $_to_center_with_delay ); 2662 }, 300 ); 2663 self.triggerSimpleLoad( $_to_center ); 2664 } 2665 }, 2666 extLinks : function() { 2667 if ( ! HUParams.extLinksStyle && ! HUParams.extLinksTargetExt ) 2668 return; 2669 $('a' , '.post-inner .entry').extLinks({ 2670 addIcon : HUParams.extLinksStyle, 2671 iconClassName : 'hu-external', 2672 newTab : HUParams.extLinksTargetExt, 2673 skipSelectors : _.isObject(HUParams.extLinksSkipSelectors) ? HUParams.extLinksSkipSelectors : {} 2674 }); 2675 }, 2676 2677 parallax : function() { 2678 $( '.parallax-item' ).czrParallax(); 2679 }, 2680 };//_methods{} 2681 2682 czrapp.methods.JQPlugins = czrapp.methods.JQPlugins || {}; 2683 $.extend( czrapp.methods.JQPlugins = {} , _methods ); 2684 2685})(jQuery, czrapp); 2686var czrapp = czrapp || {}; 2687(function($, czrapp) { 2688 var _methods = { 2689 setupUIListeners : function() { 2690 var self = this; 2691 this.windowWidth = new czrapp.Value( czrapp.$_window.width() ); 2692 this.isScrolling = new czrapp.Value( false ); 2693 this.isResizing = new czrapp.Value( false ); 2694 this.scrollPosition = new czrapp.Value( czrapp.$_window.scrollTop() ); 2695 this.scrollDirection = new czrapp.Value('down'); 2696 self.previewDevice = new czrapp.Value( 'desktop' ); 2697 if ( self._isCustomizing() ) { 2698 var _setPreviewedDevice = function() { 2699 wp.customize.preview.bind( 'previewed-device', function( device ) { 2700 self.previewDevice( device ); 2701 }); 2702 }; 2703 if ( wp.customize.preview ) { 2704 _setPreviewedDevice(); 2705 } else { 2706 wp.customize.bind( 'preview-ready', function() { 2707 _setPreviewedDevice(); 2708 }); 2709 } 2710 } 2711 self.windowWidth.bind( function( to, from ) { 2712 self.isResizing( self._isMobileScreenSize ? Math.abs( from - to ) > 2 : Math.abs( from - to ) > 0 ); 2713 clearTimeout( $.data( this, 'resizeTimer') ); 2714 $.data( this, 'resizeTimer', setTimeout(function() { 2715 self.isResizing( false ); 2716 }, 50 ) ); 2717 }); 2718 self.isResizing.bind( function( is_resizing ) { 2719 czrapp.$_body.toggleClass( 'is-resizing', is_resizing ); 2720 }); 2721 this.isScrolling.bind( function( to, from ) { 2722 czrapp.$_body.toggleClass( 'is-scrolling', to ); 2723 if ( ! to ) { 2724 czrapp.trigger( 'scrolling-finished' ); 2725 } 2726 }); 2727 this.scrollPosition.bind( function( to, from ) { 2728 czrapp.$_body.toggleClass( 'is-scrolled', to > 100 ); 2729 if ( to <= 50 ) { 2730 czrapp.trigger( 'page-scrolled-top', {} ); 2731 } 2732 self.scrollDirection( to >= from ? 'down' : 'up' ); 2733 }); 2734 czrapp.$_window.resize( _.throttle( function( ev ) { self.windowWidth( czrapp.$_window.width() ); }, 10 ) ); 2735 czrapp.$_window.scroll( _.throttle( function() { 2736 self.isScrolling( true ); 2737 self.scrollPosition( czrapp.$_window.scrollTop() ); 2738 clearTimeout( $.data( this, 'scrollTimer') ); 2739 $.data( this, 'scrollTimer', setTimeout(function() { 2740 self.isScrolling( false ); 2741 }, 100 ) ); 2742 }, 10 ) ); 2743 2744 }, 2745 onSlidingCompleteResetCSS : function( $_el ) { 2746 $_el = $_el ? $_el : $(this); 2747 $_el.css({ 2748 'display' : '', 2749 'paddingTop' : '', 2750 'marginTop' : '', 2751 'paddingBottom' : '', 2752 'marginBottom' : '', 2753 'height' : '' 2754 }); 2755 }, 2756 };//_methods{} 2757 2758 czrapp.methods.UserXP = czrapp.methods.UserXP || {}; 2759 $.extend( czrapp.methods.UserXP , _methods ); 2760 2761})(jQuery, czrapp);var czrapp = czrapp || {}; 2762(function($, czrapp) { 2763 var _methods = { 2764 2765 mobileMenu : function() { 2766 var self = this; 2767 self.mobileMenu = new czrapp.Values();
2768 $('.nav-container').each( function( _index ) { 2769 if ( ! _.isString( $(this).attr( 'data-menu-id' ) ) ) 2770 return; 2771 2772 var $container = $(this), 2773 is_scrollable = _.isString( $(this).attr( 'data-menu-scrollable' ) ) && "false" == $(this).attr( 'data-menu-scrollable' ) ? false : true, 2774 _candidateId = $container.attr( 'data-menu-id' ), 2775 ctor; 2776 2777 if ( self.mobileMenu.has( _candidateId ) ) 2778 return; 2779 2780 var $navWrap = $container.find( '.nav-wrap' ); 2781 var button_selectors = '.nav-toggle, .ham__navbar-toggler, .ham__navbar-toggler-two', 2782 $button = $container.find( button_selectors ); 2783 if ( 1 == $navWrap.length && 1 == $button.length ) { 2784 ctor = czrapp.Value.extend( self.MobileCTOR ); 2785 self.mobileMenu.add( _candidateId, new ctor( _candidateId, { 2786 container : $container, 2787 menu_wrapper : $navWrap, 2788 button : $button, 2789 button_selectors : button_selectors, 2790 is_scrollable : is_scrollable 2791 })); 2792 } 2793 }); 2794 }, 2795 MobileCTOR : { 2796 initialize: function( mobile_id, constructor_options ) { 2797 var mobMenu = this; 2798 czrapp.Value.prototype.initialize.call( mobMenu, null, constructor_options ); 2799 $.extend( mobMenu, constructor_options || {} ); 2800 mobMenu( 'collapsed' ).button 2801 .toggleClass( 'collapsed', true ) 2802 .toggleClass( 'active', false ) 2803 .attr('aria-expanded', false ); 2804 mobMenu.bind( function( state ) { 2805 return $.Deferred( function() { 2806 var dfd = this; 2807 czrapp.userXP.headerSearchExpanded( false ).done( function() { 2808 mobMenu._toggleMobileMenu() 2809 .done( function( state ){ 2810 mobMenu.button.toggleClass( 'hovering', 'expanded' == state ).toggleClass( 'focusing', 'expanded' == state ); 2811 dfd.resolve(); 2812 }); 2813 }); 2814 }).promise(); 2815 }, { deferred : true } ); 2816 czrapp.setupDOMListeners( 2817 [ 2818 { 2819 trigger : 'mousedown focusin keydown', 2820 selector : mobMenu.button_selectors, 2821 actions : function() { 2822 var mobMenu = this; 2823 mobMenu( 'collapsed' == mobMenu() ? 'expanded' : 'collapsed' ); 2824 } 2825 }, 2826 { 2827 trigger : 'mouseenter', 2828 selector : mobMenu.button_selectors, 2829 actions : function() { 2830 this.button.addClass( 'hovering' ); 2831 } 2832 2833 }, 2834 { 2835 trigger : 'mouseleave', 2836 selector : mobMenu.button_selectors, 2837 actions : function() { 2838 this.button.removeClass( 'hovering' ); 2839 } 2840 2841 } 2842 ],//actions to execute 2843 { dom_el: mobMenu.container },//dom scope 2844 mobMenu //instance where to look for the cb methods 2845 ); 2846 if ( czrapp.localized.mobileSubmenuExpandOnClick ) { 2847 mobMenu.menu_wrapper.addClass( 'submenu-click-expand' ); 2848 czrapp.setupDOMListeners( 2849 [ 2850 { 2851 trigger : 'mousedown focusin keydown', 2852 selector : mobMenu.button_selectors, 2853 actions : function() { 2854 var mobMenu = this; 2855 mobMenu._collapsibleSubmenu(); 2856 }, 2857 once : true 2858 } 2859 ],//actions to execute 2860 { dom_el: mobMenu.container },//dom scope 2861 mobMenu //instance where to look for the cb methods 2862 ); 2863 } 2864 czrapp.userXP.isResizing.bind( function( is_resizing ) { 2865 if ( ! is_resizing ) 2866 return; 2867 mobMenu( 'collapsed' ); 2868 }); 2869 }, 2870 _toggleMobileMenu : function() { 2871 var mobMenu = this, 2872 expand = 'expanded' == mobMenu(), 2873 dfd = $.Deferred(); 2874 mobMenu.button 2875 .toggleClass( 'collapsed', ! expand ) 2876 .toggleClass( 'active', expand ) 2877 .attr('aria-expanded', expand ); 2878 2879 $.when( mobMenu.menu_wrapper.toggleClass( 'expanded', expand ) ).done( function() {
2880 var $navWrap = $(this); 2881 $navWrap.find('.nav').stop()[ ! expand ? 'slideUp' : 'slideDown' ]( { 2882 duration : 300, 2883 complete : function() { 2884 if ( mobMenu.is_scrollable ) { 2885 var _winHeight = 'undefined' === typeof window.innerHeight ? window.innerHeight : czrapp.$_window.height(), 2886 _visibleHeight = _winHeight - $navWrap.offset().top + czrapp.$_window.scrollTop(); 2887 $navWrap.css( { 2888 'max-height' : expand ? _visibleHeight : '', 2889 'overflow' : 'auto' 2890 }); 2891 } 2892 czrapp.userXP.onSlidingCompleteResetCSS($(this).toggleClass( 'expanded', expand )); 2893 2894 dfd.resolve( expand ); 2895 } 2896 } ); 2897 }); 2898 return dfd.promise(); 2899 }, 2900 _collapsibleSubmenu : function() { 2901 var mobMenu = this; 2902 2903 var EVENT_KEY = '.hu.submenu', 2904 Event = { 2905 SHOW : 'show' + EVENT_KEY, 2906 HIDE : 'hide' + EVENT_KEY, 2907 CLICK : 'mousedown' + EVENT_KEY, 2908 FOCUSIN : 'focusin' + EVENT_KEY, 2909 FOCUSOUT : 'focusout' + EVENT_KEY 2910 }, 2911 Classname = { 2912 DD_TOGGLE_ON_CLICK : 'submenu-click-expand', 2913 SHOWN : 'expanded', 2914 DD_TOGGLE : 'hu-dropdown-toggle', 2915 DD_TOGGLE_WRAPPER : 'hu-dropdown-toggle-wrapper', 2916 SCREEN_READER : 'screen-reader-text', 2917 2918 }, 2919 Selector = { 2920 DD_TOGGLE_PARENT : '.menu-item-has-children, .page_item_has_children', 2921 CURRENT_ITEM_ANCESTOR : '.current-menu-ancestor', 2922 SUBMENU : '.sub-menu' 2923 }, 2924 dropdownToggle = $( '<button />', { 'class': Classname.DD_TOGGLE, 'aria-expanded': false }) 2925 .append( czrapp.localized.submenuTogglerIcon ) 2926 .append( $( '<span />', { 'class': Classname.SCREEN_READER, text: czrapp.localized.i18n.collapsibleExpand } ) ), 2927 dropdownToggleWrapper = $( '<span />', { 'class': Classname.DD_TOGGLE_WRAPPER }) 2928 .append( dropdownToggle ); 2929 mobMenu.menu_wrapper.find( Selector.DD_TOGGLE_PARENT ).children('a').after( dropdownToggleWrapper ); 2930 mobMenu.menu_wrapper.find( Selector.CURRENT_ITEM_ANCESTOR +'>.'+ Classname.DD_TOGGLE_WRAPPER +' .'+ Classname.DD_TOGGLE ) 2931 .addClass( Classname.SHOWN ) 2932 .attr( 'aria-expanded', 'true' ) 2933 .find( '.'+Classname.SCREEN_READER ) 2934 .text( czrapp.localized.i18n.collapsibleCollapse ); 2935 mobMenu.menu_wrapper.find( Selector.CURRENT_ITEM_ANCESTOR +'>'+ Selector.SUBMENU ).addClass( Classname.SHOWN ); 2936 mobMenu.menu_wrapper.find( Selector.CURRENT_ITEM_ANCESTOR ).addClass( Classname.SHOWN ); 2937 2938 $( mobMenu.menu_wrapper ) 2939 .on( Event.CLICK, 'a[href="#"]', function(evt) { 2940 if ( ! czrapp.userXP._isMobileScreenSize() ) 2941 return; 2942 2943 evt.preventDefault(); 2944 evt.stopPropagation(); 2945 $(this).next('.'+Classname.DD_TOGGLE_WRAPPER).find('.'+Classname.DD_TOGGLE).trigger( Event.CLICK ); 2946 }) 2947 .on( Event.CLICK, '.'+Classname.DD_TOGGLE, function( e ) { 2948 e.preventDefault(); 2949 2950 var $_this = $( this ); 2951 $_this.trigger( $_this.closest( Selector.DD_TOGGLE_PARENT ).hasClass( Classname.SHOWN ) ? Event.HIDE: Event.SHOW ); 2952 _clearMenus( mobMenu, $_this ); 2953 }) 2954 .on( Event.SHOW+' '+Event.HIDE, '.'+Classname.DD_TOGGLE, function( e ) { 2955 var $_this = $( this ); 2956 2957 $_this.closest( Selector.DD_TOGGLE_PARENT ).toggleClass( Classname.SHOWN ); 2958 2959 $_this.closest('.'+Classname.DD_TOGGLE_WRAPPER).next( Selector.SUBMENU ) 2960 .stop()[Event.SHOW == e.type + '.' + e.namespace ? 'slideDown' : 'slideUp']( { 2961 duration: 300, 2962 complete: function() { 2963 var _to_expand = 'false' === $_this.attr( 'aria-expanded' ); 2964 $submenu = $(this); 2965 2966 $_this.attr( 'aria-expanded', _to_expand ) 2967 .find( '.'+Classname.SCREEN_READER ) 2968 .text( _to_expand ? czrapp.localized.i18n.collapsibleCollapse : czra
2968pp.localized.i18n.collapsibleExpand ); 2969 2970 $submenu.toggleClass( Classname.SHOWN ); 2971 czrapp.userXP.onSlidingCompleteResetCSS($submenu); 2972 } 2973 }); 2974 }) 2975 .on( Event.FOCUSIN, 'a[href="#"]', function(evt) { 2976 if ( ! czrapp.userXP._isMobileScreenSize() ) 2977 return; 2978 2979 evt.preventDefault(); 2980 evt.stopPropagation(); 2981 $(this).next('.'+Classname.DD_TOGGLE_WRAPPER).find('.'+Classname.DD_TOGGLE).trigger( Event.FOCUSIN ); 2982 }) 2983 .on( Event.FOCUSOUT, 'a[href="#"]', function(evt) { 2984 if ( ! czrapp.userXP._isMobileScreenSize() ) 2985 return; 2986 evt.preventDefault(); 2987 evt.stopPropagation(); 2988 _.delay( function() { 2989 $(this).next('.'+Classname.DD_TOGGLE_WRAPPER).find('.'+Classname.DD_TOGGLE).trigger( Event.FOCUSOUT ); 2990 }, 250 ); 2991 }) 2992 .on( Event.FOCUSIN, '.'+Classname.DD_TOGGLE, function( e ) { 2993 e.preventDefault(); 2994 2995 var $_this = $( this ); 2996 $_this.trigger( Event.SHOW ); 2997 }) 2998 .on( Event.FOCUSIN, function( evt ) { 2999 evt.preventDefault(); 3000 if ( $(evt.target).length > 0 ) { 3001 $(evt.target).addClass( 'hu-mm-focused'); 3002 } 3003 }) 3004 .on( Event.FOCUSOUT,function( evt ) { 3005 evt.preventDefault(); 3006 3007 var $_this = $( this ); 3008 _.delay( function() { 3009 if ( $(evt.target).length > 0 ) { 3010 $(evt.target).removeClass( 'hu-mm-focused'); 3011 } 3012 if ( mobMenu.container.find('.hu-mm-focused').length < 1 ) { 3013 mobMenu( 'collapsed'); 3014 } 3015 }, 200 ); 3016 3017 }); 3018 var _clearMenus = function( mobMenu, $_toggle ) { 3019 var _parentsToNotClear = $.makeArray( $_toggle.parents( Selector.DD_TOGGLE_PARENT ) ), 3020 _toggles = $.makeArray( $( '.'+Classname.DD_TOGGLE, mobMenu.menu_wrapper ) ); 3021 3022 for (var i = 0; i < _toggles.length; i++) { 3023 var _parent = $(_toggles[i]).closest( Selector.DD_TOGGLE_PARENT )[0]; 3024 3025 if (!$(_parent).hasClass( Classname.SHOWN ) || $.inArray(_parent, _parentsToNotClear ) > -1 ){ 3026 continue; 3027 } 3028 3029 $(_toggles[i]).trigger( Event.HIDE ); 3030 } 3031 }; 3032 3033 } 3034 }//MobileCTOR 3035 3036 };//_methods{} 3037 3038 czrapp.methods.UserXP = czrapp.methods.UserXP || {}; 3039 $.extend( czrapp.methods.UserXP , _methods ); 3040 3041})(jQuery, czrapp);var czrapp = czrapp || {}; 3042(function($, czrapp) { 3043 var _methods = { 3044 stickify : function() { 3045 var self = this; 3046 this.stickyCandidatesMap = { 3047 mobile : { 3048 mediaRule : 'only screen and (max-width: 719px)', 3049 selector : 'mobile-sticky' 3050 }, 3051 desktop : { 3052 mediaRule : 'only screen and (min-width: 720px)',
3053 selector : 'desktop-sticky' 3054 } 3055 }; 3056 this.stickyMenuWrapper = false; 3057 this.stickyMenuDown = new czrapp.Value( '_not_set_' ); 3058 this.stickyHeaderThreshold = 50; 3059 this.currentStickySelector = new czrapp.Value( '' );//<= will be set on init and on resize 3060 this.hasStickyCandidate = new czrapp.Value( false ); 3061 this.stickyHeaderAnimating = new czrapp.Value( false ); 3062 this.userStickyOpt = new czrapp.Value( self._setUserStickyOpt() );//set on init and on resize : stick_always, no_stick, stick_up 3063 this.currentStickySelector.bind( function( to, from ) { 3064 var _reset = function() { 3065 czrapp.$_header.css( { 'height' : '' }).removeClass( 'fixed-header-on' ); 3066 self.stickyMenuDown( false ); 3067 self.stickyMenuWrapper = false; 3068 self.hasStickyCandidate( false ); 3069 }; 3070 if ( ! _.isEmpty( to ) ) { 3071 self.hasStickyCandidate( 1 == czrapp.$_header.find( to ).length ); 3072 if ( ! self.hasStickyCandidate() ) { 3073 _reset(); 3074 } else { 3075 self.stickyMenuWrapper = czrapp.$_header.find( to ); 3076 var $_header_image = $('#header-image-wrap').find('.site-image'); 3077 if ( 1 == $_header_image.length ) { 3078 $_header_image.bind( 'header-image-loaded', function() { 3079 czrapp.$_header.css( { 'height' : czrapp.$_header.height() }).addClass( 'fixed-header-on' ); 3080 }); 3081 if ( $_header_image[0].complete ) { 3082 $_header_image.trigger('header-image-loaded'); 3083 } else { 3084 $_header_image.load( function( img ) { 3085 $_header_image.trigger('header-image-loaded'); 3086 } ); 3087 } 3088 } else { 3089 czrapp.$_header.css( { 'height' : czrapp.$_header.height() }).addClass( 'fixed-header-on' ); 3090 } 3091 } 3092 } else {//we don't have a candidate 3093 _reset(); 3094 } 3095 }); 3096 this.scrollPosition.bind( function( to, from ) { 3097 if ( ! self.hasStickyCandidate() ) 3098 return; 3099 if ( Math.abs( to - from ) <= 5 ) 3100 return; 3101 self.stickyMenuDown( to < from ); 3102 }); 3103 var _maybeResetTop = function() { 3104 if ( 'up' == self.scrollDirection() ) 3105 self._mayBeresetTopPosition(); 3106 }; 3107 czrapp.bind( 'scrolling-finished', _maybeResetTop );//react on scrolling finished <=> after the timer 3108 czrapp.bind( 'topbar-collapsed', _maybeResetTop );//react on topbar collapsed, @see topNavToLife 3109 self.stickyMenuDown.validate = function( value ) { 3110 if ( ! self.hasStickyCandidate() ) 3111 return false; 3112 if ( 'stick_up' != self.userStickyOpt() ) 3113 return true; 3114 if ( self.scrollPosition() < self.stickyHeaderThreshold && ! value ) { 3115 if ( ! self.isScrolling() ) { 3116 czrapp.errorLog('Menu too close from top to be moved up'); 3117 } 3118 return self.stickyMenuDown(); 3119 } else { 3120 return value; 3121 } 3122 }; 3123 3124 self.stickyMenuDown.bind( function( to, from, args ){ 3125 if ( ! _.isBoolean( to ) || ! self.hasStickyCandidate() ) { 3126 return $.Deferred( function() { return this.resolve().promise(); } ); 3127 } 3128 3129 args = _.extend( 3130 { 3131 direction : to ? 'down' : 'up', 3132 force : false, 3133 menu_wrapper : self.stickyMenuWrapper, 3134 fast : false 3135 }, 3136 args || {} 3137 ); 3138 return self._animate( { direction : args.direction, force : args.force, menu_wrapper : args.menu_wrapper, fast : args.fast } ); 3139 }, { deferred : true } ); 3140 self.isResizing.bind( function( is_resizing ) { 3141 self.userStickyOpt( self._setUserStickyOpt() ); 3142 self._setStickySelector(); 3143 3144 if ( self.hasStickyCandidate() ) { 3145 self.stickyMenuDown( self.scrollPosition() < self.stickyHeaderThreshold , { fast : true } ).done( function() { 3146 czrapp.$_header.css( 'height' , '' ).removeClass( 'fixed-header-on' ); 3147 if ( self.hasStickyCandidate() ) { 3148 czrapp.$_header.css( 'height' , czrapp.$_header.height() ).addClass( 'fixed-header-on' ); 3149 } 3150 }); 3151 } else { 3152 self.stickyMenuDown( false ).done( function() { 3153 $('#header').css( 'padding-top', '' ); 3154 }); 3155 } 3156 if ( ! self._isMobileScreenSize() ) { 3157 self._adjustDesktopTopNavPaddingTop(); 3158 } else { 3159 $('.full-width.topbar-enabled #header').css( 'padding-top', '' ); 3160 self._mayBeresetTopPosition(); 3161 } 3162 } );//resize(); 3163 self._setStickySelector(); 3164 if ( ! self._isMobileScreenSize() && self.hasStickyCandidate() ) { 3165 self._adjustDesktopTopNavPaddingTop(); 3166 } 3167 3168 },//stickify 3169 _setStickySelector : function() { 3170 var self = this, 3171 _match_ = false; 3172 _.each( self.stickyCandidatesMap, function( _params, _device ) { 3173 if ( _.isFunction( window.matchMedia ) && matchMedia( _params.mediaRule ).matches && 'no_stick' != self.userStickyOpt() ) { 3174 _match_ = [ '.nav-container', _params.selector ].join('.'); 3175 } 3176 }); 3177 self.currentStickySelector( _match_ ); 3178 }, 3179 _setUserStickyOpt : function( device ) { 3180 var self = this; 3181 if ( _.isUndefined( device ) ) { 3182 _.each( self.stickyCandidatesMap, function( _params, _device ) { 3183 if ( _.isFunction( window.matchMedia ) && matchMedia( _params.mediaRule ).matches ) { 3184 device = _device; 3185 } 3186 }); 3187 } 3188 device = device || 'desktop'; 3189 3190 return ( HUParams.menuStickyUserSettings && HUParams.menuStickyUserSettings[ device ] ) ? HUParams.menuStickyUserSettings[ device ] : 'no_stick'; 3191 }, 3192 _adjustDesktopTopNavPaddingTop : function() { 3193 var self = this; 3194 if ( ! self._isMobileScreenSize() && self.hasStickyCandidate() ) { 3195 $('.full-width.topbar-enabled #header').css( 'padding-top', czrapp.$_header.find( self.currentStickySelector() ).outerHeight() ); 3196 } else { 3197 $('#header').css( 'padding-top', '' ); 3198 } 3199 }, 3200 _mayBeresetTopPosition : function() { 3201 var self = this, $menu_wrapper = self.stickyMenuWrapper; 3202 if ( 'up' != self.scrollDirection() ) 3203 return; 3204 if ( ! $menu_wrapper.length ) 3205 return; 3206 3207 if ( self.scrollPosition() >= self.stickyHeaderThreshold ) 3208 return; 3209 3210 if ( ! self._isMobileScreenSize() ) { 3211 self._adjustDesktopTopNavPaddingTop(); 3212 } 3213 self.stickyMenuDown( true, { force : true, fast : true } ).done( function() { 3214 self.stickyHeaderAnimating( true ); 3215 ( function() { 3216 return $.Deferred( function() { 3217 var dfd = this; 3218 _.delay( function() { 3219 if ( 'up' == self.scrollDirection() && self.scrollPosition() < 10) { 3220 $menu_wrapper.css({
3221 '-webkit-transform': '', /* Safari and Chrome */ 3222 '-moz-transform': '', /* Firefox */ 3223 '-ms-transform': '', /* IE 9 */ 3224 '-o-transform': '', /* Opera */ 3225 transform: '' 3226 }); 3227 } 3228 self.stickyHeaderAnimating( false ); 3229 dfd.resolve(); 3230 }, 10 ); 3231 }).promise(); 3232 } )().done( function() { }); 3233 }); 3234 }, 3235 _animate : function( args ) { 3236 args = _.extend( 3237 { 3238 direction : 'down', 3239 force : false, 3240 menu_wrapper : {}, 3241 fast : false 3242 }, 3243 args || {} 3244 ); 3245 var dfd = $.Deferred(), 3246 self = this, 3247 $menu_wrapper = ! args.menu_wrapper.length ? czrapp.$_header.find( self.currentStickySelector() ) : args.menu_wrapper, 3248 _startPosition = self.scrollPosition(), 3249 _endPosition = _startPosition; 3250 if ( ! $menu_wrapper.length ) 3251 return dfd.resolve().promise(); 3252 3253 if ( ! czrapp.$_header.hasClass( 'fixed-header-on' ) ) { 3254 czrapp.$_header.addClass( 'fixed-header-on' ); 3255 } 3256 var _do = function() { 3257 var translateYUp = $menu_wrapper.outerHeight(), 3258 translateYDown = 0, 3259 _translate; 3260 3261 if ( args.fast ) { 3262 $menu_wrapper.addClass('fast'); 3263 } 3264 if ( _.isFunction( window.matchMedia ) && matchMedia( 'screen and (max-width: 600px)' ).matches && 1 == czrapp.$_wpadminbar.length ) { 3265 translateYDown = translateYDown - $menu_wrapper.outerHeight(); 3266 } 3267 _translate = 'up' == args.direction ? 'translate(0px, -' + translateYUp + 'px)' : 'translate(0px, -' + translateYDown + 'px)'; 3268 self.stickyHeaderAnimating( true ); 3269 self.stickyHeaderAnimationDirection = args.direction; 3270 $menu_wrapper.toggleClass( 'sticky-visible', 'down' == args.direction ); 3271 3272 $menu_wrapper.css({ 3273 '-webkit-transform': _translate, /* Safari and Chrome */ 3274 '-moz-transform': _translate, /* Firefox */ 3275 '-ms-transform': _translate, /* IE 9 */ 3276 '-o-transform': _translate, /* Opera */ 3277 transform: _translate 3278 }); 3279 3280 _.delay( function() { 3281 self.stickyHeaderAnimating( false ); 3282 if ( args.fast ) { 3283 $menu_wrapper.removeClass('fast'); 3284 } 3285 dfd.resolve(); 3286 }, args.fast ? 100 : 350 ); 3287 };//_do 3288 3289 _.delay( function() { 3290 var sticky_menu_id = _.isString( $menu_wrapper.attr('data-menu-id') ) ? $menu_wrapper.attr('data-menu-id') : ''; 3291 if ( czrapp.userXP.mobileMenu.has( sticky_menu_id ) ) { 3292 czrapp.userXP.mobileMenu( sticky_menu_id )( 'collapsed' ).done( function() { 3293 _do(); 3294 }); 3295 } else { 3296 _do(); 3297 } 3298 }, 50 ); 3299 return dfd.promise(); 3300 } 3301 };//_methods{} 3302 3303 czrapp.methods.UserXP = czrapp.methods.UserXP || {}; 3304 $.extend( czrapp.methods.UserXP , _methods ); 3305 3306})(jQuery, czrapp);var czrapp = czrapp || {}; 3307(function($, czrapp) { 3308 var _methods = { 3309 sidebarToLife : function() { 3310 var self = this; 3311 self.sidebars = new czrapp.Values();
3312 self.maxColumnHeight = new czrapp.Value( self._getMaxColumnHeight() ); 3313 self.maxColumnHeight.bind( function(to) { 3314 self.sidebars.each( function( _sb_ ) { 3315 if ( _sb_.isStickyfiable() ) { 3316 _sb_._setStickyness(); 3317 } 3318 }); 3319 }); 3320 czrapp.isMobileUserAgent = new czrapp.Value( '1' == HUParams.isWPMobile ); 3321 3322 if ( ! _.isUndefined( window.MobileDetect ) && _.isFunction( window.MobileDetect ) ) { // <= is js-mobile-detect option checked ? 3323 var _md = new MobileDetect(window.navigator.userAgent); 3324 czrapp.isMobileUserAgent( ! _.isNull( _md.mobile() ) ); 3325 } 3326 3327 3328 self.sidebars.stickyness = new czrapp.Value( {} ); 3329 self.sidebars.stickyness.bind( function( state ) { 3330 var _isAfterTop = true; 3331 self.sidebars.each( function( _sb_ ) { 3332 _isAfterTop = 'top' != _sb_.stickyness() && _isAfterTop; 3333 }); 3334 czrapp.$_mainWrapper.css({ overflow : _isAfterTop ? 'hidden' : '' }); 3335 }); 3336 czrapp.ready.then( function() { 3337 czrapp.userXP.stickyHeaderAnimating.bind( function( animating ) { 3338 if ( ! self._isStickyOptionOn() ) 3339 return; 3340 self.sidebars.each( function( _sb_ ) { 3341 _sb_._translateSbContent( czrapp.userXP.stickyMenuDown() ); 3342 }); 3343 }); 3344 }); 3345 czrapp.$_window.scroll( _.throttle( function() { 3346 if ( ! self._isStickyOptionOn() ) 3347 return; 3348 3349 self.sidebars.each( function( _sb_ ) { 3350 if ( _sb_.isStickyfiable() ) { 3351 _sb_._setStickyness(); 3352 } 3353 }); 3354 }, 10 ) );//window.scroll() throttled 3355 czrapp.$_window.scroll( _.throttle( function() { 3356 czrapp.userXP.maxColumnHeight( czrapp.userXP._getMaxColumnHeight() ); 3357 self.sidebars.each( function( _sb_ ) { 3358 if ( _sb_.isStickyfiable() && 'expanded' == _sb_() ) { 3359 _sb_._stickify(); 3360 } 3361 }); 3362 }, 300 ) );//window.scroll() throttled 3363 czrapp.userXP.windowWidth.bind( function( width ) { 3364 czrapp.userXP.maxColumnHeight( czrapp.userXP._getMaxColumnHeight() ); 3365 self.sidebars.each( function( _sb_ ) { 3366 _sb_.isStickyfiable( _sb_._isStickyfiable() ); 3367 _sb_( 'collapsed' ).done( function() { 3368 _sb_._stickify(); 3369 }); 3370 }); 3371 }); 3372 $( '.s1, .s2', '#wrapper .main' ).each( function( index ) { 3373 if ( ! _.isString( $(this).attr( 'data-sb-id') ) || _.isEmpty( $(this).attr( 'data-sb-id') ) ) 3374 return; 3375 3376 var $container = $(this), 3377 _id = $container.attr( 'data-sb-id'), 3378 _position = $container.attr( 'data-position'), 3379 _userLayout = $container.attr( 'data-layout'), 3380 ctor; 3381 3382 if ( ! _.isString( _position ) || ! _.isString( _userLayout ) || ! _.isString( _id ) ) { 3383 throw new Error( 'Missing id, position or layout for sidebar ' + _id ); 3384 } 3385 3386 if ( 1 != $container.find('.sidebar-content').length || 1 != $container.find('.sidebar-toggle').length ) { 3387 throw new Error( 'Missing content or toggle button for sidebar ' + _id ); 3388 } 3389 ctor = czrapp.Value.extend( self.SidebarCTOR ); 3390 self.sidebars.add( _id, new ctor( _id, { 3391 container : $container, 3392 position : _position,//can take left, middle-left, middle-right, right 3393 layout : _userLayout,//can take : col-2cr, co-2cl, col-3cr, col-3cm, col-3cl 3394 extended_width : 's1' == _id ? 340 : 260//<= hard coded in the base CSS, could be made dynamic in the future 3395 })); 3396 });//$( '.s1, .s2', '#wrapper' ).each() 3397 3398 }, 3399 _isUserStickyOnMobiles : function() { 3400 if ( HUParams.sbStickyUserSettings && _.isObject( HUParams.sbStickyUserSettings ) ) { 3401 var _dbOpt = _.extend( { mobile : false }, HUParams.sbStickyUserSettings ); 3402 return _dbOpt.mobile || false; 3403 } else { 3404 return false; 3405 } 3406 }, 3407 _isUserStickyOnDesktops : function() { 3408 if ( HUParams.sbStickyUserSettings && _.isObject( HUParams.sbStickyUserSettings ) ) { 3409 var _dbOpt = _.extend( { desktop : false }, HUParams.sbStickyUserSettings ); 3410 return _dbOpt.desktop || false; 3411 } else { 3412 return false; 3413 } 3414 }, 3415 _isStickyOptionOn : function() { 3416 var _isMobileScreenSize = false, self = this; 3417 if ( self._isUserStickyOnMobiles() || self._isUserStickyOnDesktops() ) { 3418 _isMobileScreenSize = czrapp.isMobileUserAgent() ? true : czrapp.userXP._isMobileScreenSize(); 3419 return _isMobileScreenSize ? self._isUserStickyOnMobiles() : self._isUserStickyOnDesktops(); 3420 } else { 3421 return false; 3422 } 3423 }, 3424 _getMaxColumnHeight : function() { 3425 var _hs = []; 3426 czrapp.userXP.sidebars.each( function( _sb_ ) { 3427 _hs.push( _sb_._getVisibleHeight() ); 3428 }); 3429 $('.content', '#wrapper .main').each( function() { 3430 if ( 1 == $(this).length ) 3431 _hs.push( $(this).outerHeight() ); 3432 }); 3433 return Math.max.apply(null, _hs ); 3434 }, 3435 SidebarCTOR : { 3436 initialize : function( id, options ) { 3437 if ( ! $.isReady ) { 3438 throw new Error( 'Sidebars must be instantiated on DOM ready' ); 3439 } 3440 var sb = this; 3441 sb.id = id; 3442 $.extend( sb, options || {} ); 3443 3444 sb.button_selectors = '.sidebar-toggle'; 3445 sb.button = sb.container.find( sb.button_selectors ); 3446 3447 czrapp.Value.prototype.initialize.call( sb, null, options ); 3448 sb.stickyness = new czrapp.Value();//<= will be set to a string on scroll : 'top', 'between', 'bottom' 3449 sb.animating = new czrapp.Value( false ); 3450 sb.isStickyfiable = new czrapp.Value( sb._isStickyfiable() ); 3451 czrapp.setupDOMListeners( 3452 [ 3453 { 3454 trigger : 'focusin mousedown keydown', 3455 selector : sb.button_selectors, 3456 actions : function() { 3457 var sb = this; 3458 czrapp.userXP.sidebars.each( function( _sb_ ) { 3459 _sb_( _sb_.id == sb.i
3459d ? _sb_() : 'collapsed' ); 3460 }); 3461 sb( 'collapsed' == sb() ? 'expanded' : 'collapsed' ).done( function() { 3462 sb._stickify(); 3463 }); 3464 } 3465 }, 3466 { 3467 trigger : 'mouseenter', 3468 selector : sb.button_selectors, 3469 actions : function() { 3470 this.button.addClass( 'hovering' ); 3471 } 3472 3473 }, 3474 { 3475 trigger : 'mouseleave', 3476 selector : sb.button_selectors, 3477 actions : function() { 3478 this.button.removeClass( 'hovering' ); 3479 } 3480 3481 } 3482 ],//actions to execute 3483 { dom_el: sb.container },//dom scope 3484 sb //instance where to look for the cb methods 3485 ); 3486 sb( 'collapsed' ); 3487 sb.container.css({ 3488 '-webkit-transform': 'translateZ(0)', //Safari and Chrome 3489 '-moz-transform': 'translateZ(0)', /* Firefox */ 3490 '-ms-transform': 'translateZ(0)', /* IE 9 */ 3491 '-o-transform': 'translateZ(0)', /* Opera */ 3492 transform: 'translateZ(0)' 3493 }); 3494 sb.bind( function( state ) { 3495 return $.Deferred( function() { 3496 var dfd = this; 3497 sb._toggleSidebar() 3498 .done( function( state ){ 3499 sb.button.toggleClass( 'hovering', 'expanded' == state ); 3500 dfd.resolve(); 3501 }); 3502 }).promise(); 3503 }, { deferred : true } ); 3504 sb.validate = function( value ) { 3505 return this._isExpandable() ? value : 'collapsed'; 3506 }; 3507 sb.stickyness.bind( function( to, from ) { 3508 _stckness = $.extend( {}, true, _.isObject( czrapp.userXP.sidebars.stickyness() ) ? czrapp.userXP.sidebars.stickyness() : {} ); 3509 _stckness[ sb.id ] = to; 3510 czrapp.userXP.sidebars.stickyness( _stckness ); 3511 var _state = to; 3512 if ( sb._isHighestColumn() && 'between' == _state ) { 3513 switch( from ) { 3514 case 'top' : 3515 _state = 'bottom'; 3516 break; 3517 case 'bottom' : 3518 _state = 'top'; 3519 break; 3520 } 3521 } 3522 sb._stickify( _state ); 3523 }); 3524 sb.isStickyfiable.bind( function( isStickyfiable ) { 3525 if ( ! isStickyfiable ) 3526 sb._resetStickyness(); 3527 }); 3528 },//initialize 3529 _setStickyness : function() { 3530 var sb = this; 3531 if ( ! sb.isStickyfiable() ) 3532 return; 3533 var startStickingY = czrapp.$_mainWrapper.offset().top, 3534 contentBottomToTop = startStickingY + czrapp.userXP.maxColumnHeight(),//czrapp.userXP._getMaxColumnHeight() 3535 topSpacing = 0,//_setTopSpacing(); 3536 scrollTop = czrapp.$_window.scrollTop(), 3537 stopStickingY = contentBottomToTop - ( sb.container.outerHeight() + topSpacing ); 3538 3539 3540 if ( stopStickingY < 0 ) 3541 return; 3542 sb.stickyness( ( function() { 3543 if ( scrollTop >= stopStickingY ) { 3544 return 'bottom'; 3545 } else if ( scrollTop >= startStickingY ) { 3546 return 'between'; 3547 } else if( scrollTop < startStickingY ) { 3548 return 'top'; 3549 } 3550 })() ); 3551 }, 3552 _stickify : function( stickyness ) { 3553 var sb = this; 3554 if ( ! sb.isStickyfiable() ) 3555 return; 3556 stickyness = stickyness || sb.stickyness(); 3557 czrapp.userXP.maxColumnHeight( czrapp.userXP._getMaxColumnHeight(), { silent : true } );//<= we update it silently here to avoid infinite looping => the maxColumnHeight always triggers a _stickify action in other contexts
3558 var contentBottomToTop = czrapp.$_mainWrapper.offset().top + czrapp.userXP.maxColumnHeight(), 3559 expanded = 'expanded' == sb(); 3560 3561 switch( stickyness ) { 3562 case 'top' : 3563 sb._resetStickyness();//remove sticky class and dynamic style 3564 break; 3565 3566 case 'between' : 3567 sb.container.addClass( 'sticky' ); 3568 sb._translateSbContent(); 3569 3570 if ( ! expanded ) { 3571 sb.container.css({ 3572 position : 'fixed', 3573 top : '0px', 3574 height : expanded ? Math.max( sb._getInnerHeight(), czrapp.$_window.height() ) + 'px' : '', 3575 left : sb._getStickyXOffset(),//<= depdendant of the sidebar position : left, middle-left, middle-right, right 3576 'padding-bottom' : expanded ? 0 : '', 3577 }); 3578 } else { 3579 sb._resetStickyness(); 3580 } 3581 break; 3582 3583 case 'bottom' : 3584 sb._resetStickyness();//remove sticky class and dynamic style 3585 if ( ! sb._isHighestColumn() ) { 3586 sb.container.offset( { top: contentBottomToTop - sb.container.outerHeight() } ); 3587 } 3588 break; 3589 }//switch() 3590 },//stickify 3591 _toggleSidebar : function() { 3592 var sb = this, 3593 expanded = 'expanded' == sb(); 3594 3595 return $.Deferred( function() { 3596 var _dfd_ = this; 3597 3598 var _transX, 3599 _marginRight, 3600 _marginLeft, 3601 _translate; 3602 ( function() { 3603 return $.Deferred( function() { 3604 var _dfd = this; 3605 3606 sb.animating( true ); 3607 czrapp.$_body 3608 .toggleClass('sidebar-expanded', expanded ) 3609 .toggleClass('sidebar-expanding', expanded ) 3610 .toggleClass('sidebar-collapsing', ! expanded ); 3611 sb.container 3612 .toggleClass( 'expanding', expanded ) 3613 .toggleClass( 'collapsing', ! expanded ); 3614 switch( sb.position ) { 3615 case 'right' : 3616 _transX = - ( sb.extended_width - 50 ); 3617 if ( 'col-3cl' == sb.layout ) { 3618 _marginRight = expanded ? - sb.extended_width - 50 : -100; 3619 } else { 3620 _marginRight = expanded ? - sb.extended_width : -50; 3621 } 3622 break; 3623 case 'middle-right' : 3624 _transX = - ( sb.extended_width - 50 ); 3625 _marginRight = expanded ? - sb.extended_width : -50; 3626 break; 3627 case 'middle-left' : 3628 _transX = sb.extended_width - 50; 3629 _marginLeft = expanded ? - sb.extended_width : -50; 3630 break; 3631 case 'left' : 3632 _transX = sb.extended_width - 50; 3633 if ( 'col-3cr' == sb.layout ) { 3634 _marginLeft = expanded ? - sb.extended_width - 50 : -100; 3635 } else { 3636 _marginLeft = expanded ? - sb.extended_width : -50; 3637 } 3638 break; 3639 } 3640 3641 _transX = expanded ? _transX : 0; 3642 _translate = 'translate3d(' + _transX + 'px,0px,0px)'; 3643 sb.container.css({ 3644 width : expanded ? sb.extended_width + 'px' : '50px', 3645 'margin-right' : _.isEmpty( _marginRight + '' ) ? '' : _marginRight + 'px', 3646 'margin-left' : _.isEmpty( _marginLeft + '' ) ? '' : _marginLeft + 'px', 3647 height : expanded ? sb._getExpandedHeight() + 'px' : sb.container.height() + 'px',
3648 '-webkit-transform': _translate, /* Safari and Chrome */ 3649 '-moz-transform': _translate, /* Firefox */ 3650 '-ms-transform': _translate, /* IE 9 */ 3651 '-o-transform': _translate, /* Opera */ 3652 transform: _translate 3653 }); 3654 3655 czrapp.$_mainContent.css({ 3656 '-webkit-transform': _translate, /* Safari and Chrome */ 3657 '-moz-transform': _translate, /* Firefox */ 3658 '-ms-transform': _translate, /* IE 9 */ 3659 '-o-transform': _translate, /* Opera */ 3660 transform: _translate, 3661 }); 3662 sb.container.find('.sidebar-content').css('opacity', expanded ? 0 : 1 ); 3663 sb.container.find('.icon-sidebar-toggle').css('opacity', 0); 3664 _.delay( function() { 3665 _dfd.resolve(); 3666 }, 350 );//transition: width .35s ease-in-out; 3667 }).promise(); 3668 })().done( function() { 3669 3670 sb.container.toggleClass( 'expanded', expanded ).toggleClass('collapsed', ! expanded ); 3671 3672 sb.container 3673 .removeClass( 'expanding') 3674 .removeClass( 'collapsing') 3675 .css({ 3676 width : expanded ? sb.extended_width + 'px' : '', 3677 'margin-right' : '', 3678 'margin-left' : '', 3679 height : expanded ? sb._getExpandedHeight() + 'px' : '', 3680 }); 3681 sb.container.find('.icon-sidebar-toggle').css('opacity', 1); 3682 sb.container.find('.sidebar-content') 3683 .css({ 3684 opacity : '', 3685 }); 3686 sb.animating( false ); 3687 czrapp.$_body.removeClass('sidebar-expanding').removeClass('sidebar-collapsing'); 3688 czrapp.userXP.maxColumnHeight( czrapp.userXP._getMaxColumnHeight() ); 3689 if ( sb.isStickyfiable() ) { 3690 sb._setStickyness(); 3691 } 3692 3693 if ( expanded ) { 3694 var $_scrollTopEl = 1 == $('#ha-large-header').length ? $('#ha-large-header') : czrapp.$_header; 3695 $('html, body').animate({ 3696 scrollTop: $_scrollTopEl.height() 3697 }, { 3698 duration: 'slow', 3699 complete : function() { 3700 _dfd_.resolve(); 3701 } 3702 }); 3703 } else { 3704 _dfd_.resolve(); 3705 } 3706 }); 3707 }).promise(); 3708 },//toggleSidebar 3709 _resetStickyness : function() { 3710 var sb = this; 3711 sb.container.removeClass('sticky'); 3712 sb.container 3713 .css({ 3714 position : '', 3715 top : '', 3716 left : '', 3717 right : '', 3718 'margin-left' : '', 3719 'margin-right' : '', 3720 'padding-bottom' : '', 3721 'min-height' : '' 3722 }); 3723 if ( 'expanded' != sb() ) { 3724 sb.container.css( 'height' , '' ); 3725 } 3726 sb._translateSbContent(); 3727 }, 3728 _translateSbContent : function( stickyMenuDown ) { 3729 if ( this._isHighestColumn() ) 3730 return; 3731 stickyMenuDown = stickyMenuDown || czrapp.userXP.stickyMenuDown(); 3732 var sb = this, 3733 translateYUp = 0, 3734 translateYDown = 0, 3735 _translate = '',
3736 _stickyMenuWrapper = czrapp.userXP.stickyMenuWrapper,//@stored dynamically in userXP stickify 3737 _stickyMenuHeight = 1 == _stickyMenuWrapper.length ? _stickyMenuWrapper.height() : 50; 3738 if ( 'between' == sb.stickyness() ) { 3739 if ( 1 == czrapp.$_wpadminbar.length && czrapp.userXP.hasStickyCandidate() ) { 3740 translateYUp = translateYUp + czrapp.$_wpadminbar.outerHeight(); 3741 translateYDown = translateYDown + czrapp.$_wpadminbar.outerHeight(); 3742 } 3743 if ( stickyMenuDown && czrapp.userXP.hasStickyCandidate() ) { 3744 translateYUp = translateYUp + _stickyMenuHeight; 3745 } 3746 } 3747 3748 _translate = ( stickyMenuDown && 'between' == sb.stickyness() ) ? 'translate(0px, ' + translateYUp + 'px)' : 'translate(0px, ' + translateYDown + 'px)'; 3749 3750 sb.container.find('.sidebar-content, .sidebar-toggle').css({ 3751 '-webkit-transform': _translate, /* Safari and Chrome */ 3752 '-moz-transform': _translate, /* Firefox */ 3753 '-ms-transform': _translate, /* IE 9 */ 3754 '-o-transform': _translate, /* Opera */ 3755 transform: _translate 3756 }); 3757 }, 3758 _getStickyXOffset : function() { 3759 var sb = this, 3760 expanded = 'expanded' == sb(), 3761 $mainWrapper = $('.main', '#wrapper'), 3762 $mainContent = $mainWrapper.find('.content'), 3763 xFixedOffset = ''; 3764 3765 if ( 'between' != sb.stickyness() ) 3766 return ''; 3767 switch( sb.position ) { 3768 case 'left' : 3769 if ( expanded ) { 3770 xFixedOffset = $mainWrapper.offset().left + 50; 3771 } else { 3772 xFixedOffset = $mainWrapper.offset().left + sb.container.width(); 3773 } 3774 if ( 'col-3cr' == sb.layout ) { 3775 if ( expanded ) { 3776 xFixedOffset = $mainWrapper.offset().left + czrapp.userXP.sidebars('s2').container.width() + 50; 3777 } else { 3778 xFixedOffset = ''; 3779 } 3780 } 3781 break; 3782 case 'middle-left' : 3783 xFixedOffset = czrapp.userXP.sidebars('s1').container.width() + $mainWrapper.offset().left + 50; 3784 if ( 'col-3cr' == sb.layout ) { 3785 if ( expanded ) { 3786 } else { 3787 xFixedOffset = ''; 3788 } 3789 } 3790 break; 3791 case 'middle-right' : 3792 xFixedOffset = $mainWrapper.offset().left + $mainContent.outerWidth(); 3793 break; 3794 case 'right' : 3795 if ( expanded ) { 3796 xFixedOffset = $mainWrapper.offset().left + $mainWrapper.outerWidth() - 50; 3797 } else { 3798 xFixedOffset = $mainWrapper.offset().left + $mainWrapper.outerWidth() - sb.container.width(); 3799 } 3800 break; 3801 } 3802 return _.isEmpty( xFixedOffset ) ? xFixedOffset : xFixedOffset + 'px'; 3803 }, 3804 _getExpandedHeight : function() { 3805 var sb = this, 3806 _winHeight = czrapp.$_window.height(), 3807 _contentBottomToTop = czrapp.$_mainWrapper.offset().top + czrapp.$_mainWrapper.find('.content').outerHeight() - sb.container.offset().top, 3808 _maxColHeight = czrapp.userXP.maxColumnHeight(); 3809 return Math.max( _winHeight, sb._getInnerHeight() ); 3810 3811 3812 }, 3813 _isExpandable : function() { 3814 return _.isFunction( window.matchMedia ) && matchMedia( 'only screen and (min-width: 480px) and (max-width: 1200px)' ).matches; 3815 }, 3816 _isStickyfiable : function() { 3817 return czrapp.userXP._isStickyOptionOn() && 3818 1 == czrapp.$_mainWrapper.length && 3819 1 == czrapp.$_mainContent.length && 3820 _.isFunction( window.matchMedia ) && matchMedia( 'only screen and (min-width: 480px)' ).matches; 3821 }, 3822 _isHighestColumn : function() { 3823 return czrapp.userXP.maxColumnHeight() == this._getInnerHeight(); 3824 }, 3825 _getInnerHeight : function() { 3826 return this.container.find('.sidebar-content').height() + this.container.find('.sidebar-toggle').height(); 3827 }, 3828 _getVisibleHeight : function() { 3829 return 'expanded' == this() ? this._getInnerHeight() : this.container.height(); 3830 } 3831 }//SidebarCTOR 3832 };//_methods{} 3833 3834 czrapp.methods.UserXP = czrapp.methods.UserXP || {}; 3835 $.extend( czrapp.methods.UserXP , _methods ); 3836 3837})(jQuery, czrapp);var czrapp = czrapp || {}; 3838(function($, czrapp) { 3839 var _methods = { 3840 fittext : function() { 3841 if ( ! _.isObject( HUParams.fitTextMap ) ) 3842 return; 3843 3844 var _userBodyFontSize = _.isNumber( HUParams.userFontSize ) && HUParams.userFontSize * 1 > 0 ? HUParams.userFontSize : 16, 3845 _fitTextMap = HUParams.fitTextMap, 3846 _fitTextCompression = HUParams.fitTextCompression; 3847 3848 if (_.size( _fitTextMap ) < 1 ) { 3849 czrapp.errorLog( 'Unable to apply fittext params, wrong HUParams.fitTextMap.'); 3850 return; 3851 } 3852 _.each( _fitTextMap, function( data, key ) { 3853 if ( ! _.isObject( data ) ) 3854 return; 3855 data = _.extend( { 3856 selectors : '', 3857 minEm : 1, 3858 maxEm : 1 3859 }, data ); 3860 if ( 1 > $( data.selectors ).length ) 3861 return; 3862 var _compressionRatio = ( data.compression && _.isNumber( data.compression ) ) ? data.compression : _.isNumber( _fitTextCompression ) ? _fitTextCompression : 1.5; 3863 $( data.selectors ).fitText( _compressionRatio, { 3864 minFontSize : ( Math.round( data.minEm * _userBodyFontSize * 100) / 100 ) + 'px', 3865 maxFontSize : ( Math.round( data.maxEm * _userBodyFontSize * 100) / 100 ) + 'px' 3866 } ).addClass( 'fittexted_for_' + key ); 3867 }); 3868 }, 3869 outline: function() { 3870 if ( czrapp.$_body.hasClass( 'mozilla' ) && 'function' == typeof( tcOutline ) ) 3871 tcOutline(); 3872 }, 3873 smoothScroll: function() { 3874 if ( HUParams.SmoothScroll && HUParams.SmoothScroll.Enabled ) 3875 smoothScroll( HUParams.SmoothScroll.Options ); 3876 }, 3877 topNavToLife : function() { 3878 var self = this, 3879 _sel = '.topbar-toggle-down',
3880 $topbar = $('#nav-topbar.desktop-sticky'), 3881 $topbarNavWrap = $topbar.find('.nav-wrap'); 3882 3883 self.topNavExpanded = new czrapp.Value( false ); 3884 if ( 1 != $('#nav-topbar.desktop-sticky').length || 1 != $('#nav-topbar.desktop-sticky').find('.nav-wrap').length ) 3885 return; 3886 var _mayBeToggleArrow = function( force ) { 3887 $( _sel, $topbar ).css( { 3888 display : ( ( $topbarNavWrap.height() > 60 || force ) && ! czrapp.userXP._isMobileScreenSize() ) ? 'inline-block' : '' 3889 } ); 3890 }; 3891 var _updateMaxWidth = function() { 3892 $topbar.css( { 'max-width' : czrapp.$_window.width() } ); 3893 }; 3894 _.delay( _mayBeToggleArrow, 100 ); 3895 _updateMaxWidth(); 3896 czrapp.userXP.windowWidth.bind( function() { 3897 _updateMaxWidth(); 3898 _mayBeToggleArrow(); 3899 czrapp.userXP.topNavExpanded( false ); 3900 }); 3901 self.topNavExpanded.bind( function( exp, from, params ) { 3902 params = _.extend( { height : 0 }, params || {} ); 3903 return $.Deferred( function() { 3904 var _dfd = this, 3905 _expandHeight = Math.max( $topbarNavWrap.height(), params.height ); 3906 _mayBeToggleArrow( exp ); 3907 czrapp.userXP.headerSearchExpanded( false ).done( function() { 3908 $.when( $( '#header' ).toggleClass( 'topbar-expanded', exp ) ).done( function() { 3909 $( _sel, $topbar ).find('i[data-toggle="' + ( exp ? 'down' : 'up' ) + '"]').css( { opacity : 0 }); 3910 3911 $topbar.css({ 3912 height : exp ? _expandHeight + 'px' : '50px', 3913 overflow : exp ? 'visible' : '' 3914 }); 3915 _.delay( function() { 3916 $( _sel, $topbar ).find('i[data-toggle="' + ( exp ? 'down' : 'up' ) + '"]').css( { display :'none' }); 3917 $( _sel, $topbar ).find('i[data-toggle="' + ( exp ? 'up' : 'down' ) + '"]').css({ display :'inline-block' , opacity : exp ? 1 : '' }); 3918 _dfd.resolve(); 3919 if ( ! exp ) { 3920 _mayBeToggleArrow(); 3921 czrapp.trigger('topbar-collapsed');//<= will be listened to by the sticky menu to maybe adjust the top padding 3922 } 3923 }, 250 );//transition: height 0.35s ease-in-out; 3924 }); 3925 }); 3926 }).promise(); 3927 }, { deferred : true } ); 3928 czrapp.setupDOMListeners( 3929 [ 3930 { 3931 trigger : 'click keydown', 3932 selector : _sel, 3933 actions : function() { 3934 czrapp.userXP.topNavExpanded( ! czrapp.userXP.topNavExpanded() ); 3935 } 3936 }, 3937 ],//actions to execute 3938 { dom_el: $('#header') },//dom scope 3939 czrapp.userXP //instance where to look for the cb methods 3940 ); 3941 if ( czrapp.userXP.stickyHeaderAnimating ) { 3942 czrapp.userXP.stickyHeaderAnimating.bind( function( animating ) { 3943 czrapp.userXP.topNavExpanded( false ); 3944 }); 3945 } 3946 }, 3947 headerSearchToLife : function() { 3948 var self = this, 3949 _sel = '.toggle-search',
3950 $topbar = $('#nav-topbar.desktop-sticky'); 3951 3952 self.headerSearchExpanded = new czrapp.Value( false ); 3953 self.headerSearchExpanded.bind( function( exp ) { 3954 return $.Deferred( function() { 3955 var _dfd = this; 3956 $.when( $( _sel, '#header' ).toggleClass( 'active', exp ) ).done( function() { 3957 if ( exp ) { 3958 $topbar.css( { 3959 overflow : ! exp ? '' : 'visible', 3960 height : czrapp.userXP.topNavExpanded() ? ( 1 == $topbar.find('.nav-wrap').length ? $topbar.find('.nav-wrap').height() : 'auto' ) : '' 3961 }); 3962 } 3963 3964 $('.search-expand', '#header').stop()[ ! exp ? 'slideUp' : 'slideDown' ]( { 3965 duration : 250, 3966 complete : function() { 3967 if ( exp ) { 3968 $('.search-expand input', '#header').focus(); 3969 } else { 3970 $topbar.css( { overflow : '' } ); 3971 if ( ! czrapp.userXP.topNavExpanded() ) { 3972 $topbar.css( { height : '' }); 3973 } 3974 } 3975 _dfd.resolve(); 3976 } 3977 } ); 3978 }); 3979 }).promise(); 3980 }, { deferred : true } ); 3981 czrapp.setupDOMListeners( 3982 [ 3983 { 3984 trigger : 'mousedown keydown', 3985 selector : _sel, 3986 actions : function() { 3987 czrapp.userXP.headerSearchExpanded( ! czrapp.userXP.headerSearchExpanded() ); 3988 } 3989 }, 3990 ],//actions to execute 3991 { dom_el: $('#header') },//dom scope 3992 czrapp.userXP //instance where to look for the cb methods 3993 ); 3994 czrapp.userXP.windowWidth.bind( function() { 3995 self.headerSearchExpanded( false ); 3996 }); 3997 if ( czrapp.userXP.stickyHeaderAnimating ) { 3998 czrapp.userXP.stickyHeaderAnimating.bind( function( animating ) { 3999 self.headerSearchExpanded( false ); 4000 }); 4001 } 4002 $( _sel, '#header' ).on('focusin', function( evt ) { 4003 self.headerSearchExpanded( true ); 4004 }); 4005 },//toggleHeaderSearch 4006 scrollToTop : function() { 4007 $('a#back-to-top').click(function() { 4008 $('html, body').animate({scrollTop:0},'slow'); 4009 return false; 4010 }); 4011 }, 4012 widgetTabs : function() { 4013 var $tabsNav = $('.alx-tabs-nav'), 4014 $tabsNavLis = $tabsNav.children('li'), 4015 $tabsContainer = $('.alx-tabs-container'); 4016 4017 $tabsNav.each(function() { 4018 var $_el = $(this); 4019 $_el 4020 .next() 4021 .children('.alx-tab') 4022 .stop(true,true) 4023 .hide() 4024 .siblings( $_el.find('a').attr('href') ).show(); 4025 4026 $_el.children('li').first().addClass('active').stop(true,true).show(); 4027 }); 4028 4029 $tabsNavLis.on('click', function(e) { 4030 var $this = $(this); 4031 4032 $this.siblings().removeClass('active').end() 4033 .addClass('active'); 4034 4035 $this.parent().next().children('.alx-tab').stop(true,true).hide() 4036 .siblings( $this.find('a').attr('href') ).fadeIn(); 4037 e.preventDefault(); 4038 }).children( window.location.hash ? 'a[href="' + window.location.hash + '"]' : 'a:first' ).trigger('click'); 4039 }, 4040 commentTabs : function() { 4041 $(".comment-tabs li").click(function() { 4042 $(".comment-tabs li").removeClass('active'); 4043 $(this).addClass("active"); 4044 $(".comment-tab").hide(); 4045 var selected_tab = $(this).find("a").attr("href"); 4046 $(selected_tab).fadeIn(); 4047 return false; 4048 }); 4049 }, 4050 tableStyle : function() { 4051 $('table tr:odd').addClass('alt'); 4052 }, 4053 dropdownMenu : function() { 4054 var self = this,
4055 $topbar = $('#nav-topbar.desktop-sticky'), 4056 _isHoveringInTopBar = false; 4057 $('#nav-topbar.desktop-sticky').hover( 4058 function() { 4059 if ( czrapp.userXP.topNavExpanded() || czrapp.userXP._isMobileScreenSize() ) 4060 return; 4061 _isHoveringInTopBar = true; 4062 $topbar.css( { 4063 overflow : 'visible', 4064 height : 1 == $topbar.find('.nav-wrap').length ? $topbar.find('.nav-wrap').height() : 'auto' 4065 }); 4066 }, 4067 function() { 4068 if ( czrapp.userXP.topNavExpanded() || czrapp.userXP._isMobileScreenSize() ) 4069 return; 4070 _isHoveringInTopBar = false; 4071 _.delay( function() { 4072 if ( _isHoveringInTopBar ) 4073 return; 4074 if ( ! czrapp.userXP.topNavExpanded() && ! czrapp.userXP.headerSearchExpanded() ) { 4075 $topbar.css( { overflow : '', height : '' } ); 4076 _.delay( function() { 4077 czrapp.trigger('topbar-collapsed'); 4078 }, 400 ); 4079 } 4080 }, 1000 ); 4081 } 4082 ); 4083 $('.nav li').hover( 4084 function() { 4085 if ( czrapp.userXP._isMobileScreenSize() ) 4086 return; 4087 $(this).children('ul.sub-menu').hide().stop().slideDown({ 4088 duration : 'fast', 4089 complete : czrapp.userXP.onSlidingCompleteResetCSS 4090 }) 4091 .css( 'opacity', 1 ); 4092 }, 4093 function() { 4094 if ( czrapp.userXP._isMobileScreenSize() ) 4095 return; 4096 $(this).children('ul.sub-menu').stop().css( 'opacity', '' ).slideUp( { 4097 duration : 'fast', 4098 complete : czrapp.userXP.onSlidingCompleteResetCSS 4099 }); 4100 } 4101 ); 4102 $('.nav li').on('focusin', 'a', function() { 4103 4104 if ( czrapp.userXP._isMobileScreenSize() ) 4105 return; 4106 4107 $(this).addClass('hu-focused'); 4108 $(this).closest('.nav li').children('ul.sub-menu').hide().stop().slideDown({ 4109 duration : 'fast' 4110 }) 4111 .css( 'opacity', 1 ); 4112 4113 }); 4114 $('.nav li').on('focusout', 'a', function() { 4115 var $el = $(this); 4116 _.delay( function() { 4117 $el.removeClass('hu-focused'); 4118 if ( czrapp.userXP._isMobileScreenSize() ) 4119 return; 4120 if ( $('.nav li').find('.hu-focused').length < 1 ) { 4121 $('.nav li').each( function() { 4122 $(this).children('ul.sub-menu').stop().css( 'opacity', '' ).slideUp( { 4123 duration : 'fast' 4124 }); 4125 }); 4126 } 4127 if( $el.closest('.nav li').children('ul.sub-menu').find('.hu-focused').length < 1 ) { 4128 $el.closest('.nav li').children('ul.sub-menu').stop().css( 'opacity', '' ).slideUp( { 4129 duration : 'fast' 4130 }); 4131 } 4132 }, 250 ); 4133 }); 4134 }, 4135 gutenbergAlignfull : function() { 4136 var _isPage = czrapp.$_body.hasClass( 'page' ), 4137 _isSingle = czrapp.$_body.hasClass( 'single' ), 4138 _coverImageSelector = '.full-width.
4138col-1c .alignfull[class*=wp-block-cover]', 4139 _alignFullSelector = '.full-width.col-1c .alignfull[class*=wp-block-]', 4140 _alignTableSelector = [ 4141 '.boxed .themeform .wp-block-table.alignfull', 4142 '.boxed .themeform .wp-block-table.alignwide', 4143 '.full-width.col-1c .themeform .wp-block-table.alignwide' 4144 ], 4145 _coverWParallaxImageSelector = _coverImageSelector + '.has-parallax', 4146 _classParallaxTreatmentApplied = 'hu-alignfull-p', 4147 _styleId = 'hu-gutenberg-alignfull', 4148 $_refWidthElement = czrapp.$_body, 4149 $_refContainedWidthElement = $( 'section.content', $_refWidthElement ); 4150 if ( ! ( _isPage || _isSingle ) ) { 4151 return; 4152 } 4153 4154 if ( _isSingle ) { 4155 _coverImageSelector = '.single' + _coverImageSelector; 4156 _alignFullSelector = '.single' + _alignFullSelector; 4157 _alignTableSelector = '.single' + _alignTableSelector.join(',.single'); 4158 } else { 4159 _coverImageSelector = '.page' + _coverImageSelector; 4160 _alignFullSelector = '.page' + _alignFullSelector; 4161 _alignTableSelector = '.page' + _alignTableSelector.join(',.page'); 4162 } 4163 4164 if ( $( _alignFullSelector ).length > 0 ) { 4165 _add_alignelement_style( $_refWidthElement, _alignFullSelector, 'hu-gb-alignfull' ); 4166 if ( $(_coverWParallaxImageSelector).length > 0 ) { 4167 _add_parallax_treatment_style(); 4168 } 4169 czrapp.userXP.windowWidth.bind( function() { 4170 _add_alignelement_style( $_refWidthElement, _alignFullSelector, 'hu-gb-alignfull' ); 4171 _add_parallax_treatment_style(); 4172 }); 4173 } 4174 if ( $( _alignTableSelector ).length > 0 ) { 4175 _add_alignelement_style( $_refContainedWidthElement, _alignTableSelector, 'hu-gb-aligntable' ); 4176 czrapp.userXP.windowWidth.bind( function() { 4177 _add_alignelement_style( $_refContainedWidthElement, _alignTableSelector, 'hu-gb-aligntable' ); 4178 }); 4179 } 4180 function _add_parallax_treatment_style() { 4181 $( _coverWParallaxImageSelector ).each(function() { 4182 $(this) 4183 .css( 'left', '' ) 4184 .css( 'left', -1 * $(this).offset().left ) 4185 .addClass(_classParallaxTreatmentApplied); 4186 }); 4187 } 4188 function _add_alignelement_style( $_refElement, _selector, _styleId ) { 4189 var newElementWidth = $_refElement[0].getBoundingClientRect().width, 4190 $_style = $( 'head #' + _styleId ); 4191 4192 if ( 1 > $_style.length ) { 4193 $_style = $('<style />', { 'id' : _styleId }); 4194 $( 'head' ).append( $_style ); 4195 $_style = $( 'head #' + _styleId ); 4196 } 4197 $_style.html( _selector + '{width:'+ newElementWidth +'px}' ); 4198 } 4199 } 4200 4201 };//_methods{} 4202 4203 czrapp.methods.UserXP = czrapp.methods.UserXP || {}; 4204 $.extend( czrapp.methods.UserXP , _methods ); 4205 4206})(jQuery, czrapp);var czrapp = czrapp || {}; 4207(function($, czrapp) { 4208 var _methods = { 4209 mayBePrintWelcomeNote : function() { 4210 if ( ! HUParams.isWelcomeNoteOn ) 4211 return; 4212 var self = this; 4213 czrapp.welcomeNoteVisible = new czrapp.Value( false ); 4214 czrapp.welcomeNoteVisible.bind( function( visible ) { 4215 return self._toggleWelcNote( visible );//returns a promise() 4216 }, { deferred : true } ); 4217 4218 czrapp.welcomeNoteVisible( true ); 4219 },//mayBePrintWelcomeNote() 4220 4221 4222 _toggleWelcNote : function( visible ) { 4223 var self = this, 4224 dfd = $.Deferred(); 4225 4226 var _hideAndDestroy = function() { 4227 return $.Deferred( function() { 4228 var _dfd_ = this, 4229 $welcWrap = $('#bottom-welcome-note', '#footer'); 4230 if ( 1 == $welcWrap.length ) { 4231 $welcWrap.css( { bottom : '-100%' } ); 4232 _.delay( function() { 4233 $welcWrap.remove(); 4234 _dfd_.resolve(); 4235 }, 450 );// consistent with css transition: all 0.45s ease-in-out; 4236 } else { 4237 _dfd_.resolve(); 4238 } 4239 }); 4240 }; 4241 4242 var _renderAndSetup = function() { 4243 var _dfd_ = $.Deferred(), 4244 $footer = $('#footer', '#wrapper'); 4245 $.Deferred( function() { 4246 var dfd = this, 4247 _html = HUParams.welcomeContent; 4248 if ( 1 == $footer.length ) { 4249 $footer.append( _html ); 4250 _.delay( function() { 4251 $('#bottom-welcome-note', '#footer').css( { bottom : 0 } ); 4252 dfd.resolve(); 4253 }, 500 ); 4254 } else { 4255 dfd.resolve(); 4256 } 4257 }).done( function() { 4258 czrapp.setupDOMListeners( 4259 [ 4260 { 4261 trigger : 'click keydown', 4262 selector : '.close-note', 4263 actions : function() { 4264 czrapp.welcomeNoteVisible( false ).done( function() { 4265 czrapp.doAjax( { action: "dismiss_welcome_front", withNonce : true } ); 4266 }); 4267 } 4268 } 4269 ],//actions to execute 4270 { dom_el: $footer },//dom scope 4271 self //instance where to look for the cb methods 4272 ); 4273 _dfd_.resolve(); 4274 }); 4275 return _dfd_.promise(); 4276 };//renderAndSetup 4277 4278 if ( visible ) { 4279 _.delay( function() {
4280 _renderAndSetup().always( function() { 4281 dfd.resolve(); 4282 }); 4283 }, 3000 ); 4284 } else { 4285 _hideAndDestroy().done( function() { 4286 czrapp.welcomeNoteVisible( false );//should be already false 4287 dfd.resolve(); 4288 }); 4289 } 4290 _.delay( function() { 4291 czrapp.welcomeNoteVisible( false ); 4292 }, 4293 45000 4294 ); 4295 return dfd.promise(); 4296 }//_toggleWelcNote 4297 };//_methods{} 4298 4299 czrapp.methods.UserXP = czrapp.methods.UserXP || {}; 4300 $.extend( czrapp.methods.UserXP , _methods ); 4301 4302})(jQuery, czrapp);var czrapp = czrapp || {}; 4303 4304( function ( czrapp, $, _ ) { 4305 $.extend( czrapp, czrapp.Events ); 4306 czrapp.Root = czrapp.Class.extend( { 4307 initialize : function( options ) { 4308 $.extend( this, options || {} ); 4309 this.isReady = $.Deferred(); 4310 }, 4311 ready : function() { 4312 var self = this; 4313 if ( self.dom_ready && _.isArray( self.dom_ready ) ) { 4314 czrapp.status = czrapp.status || []; 4315 _.each( self.dom_ready , function( _m_ ) { 4316 if ( ! _.isFunction( _m_ ) && ! _.isFunction( self[_m_]) ) { 4317 czrapp.status.push( 'Method ' + _m_ + ' was not found and could not be fired on DOM ready.'); 4318 return; 4319 } 4320 try { ( _.isFunction( _m_ ) ? _m_ : self[_m_] ).call( self ); } catch( er ){ 4321 czrapp.status.push( [ 'NOK', self.id + '::' + _m_, _.isString( er ) ? czrapp._truncate( er ) : er ].join( ' => ') ); 4322 return; 4323 } 4324 }); 4325 } 4326 this.isReady.resolve(); 4327 } 4328 }); 4329 4330 czrapp.Base = czrapp.Root.extend( czrapp.methods.Base ); 4331 czrapp.ready = $.Deferred(); 4332 czrapp.bind( 'czrapp-ready', function() { 4333 czrapp.ready.resolve(); 4334 }); 4335 var _instantianteAndFireOnDomReady = function( newMap, previousMap, isInitial ) { 4336 if ( ! _.isObject( newMap ) ) 4337 return; 4338 _.each( newMap, function( params, name ) { 4339 if ( czrapp[ name ] || ! _.isObject( params ) ) 4340 return; 4341 4342 params = _.extend( 4343 { 4344 ctor : {},//should extend czrapp.Base with custom methods 4345 ready : [],//a list of method to execute on dom ready, 4346 options : {}//can be used to pass a set of initial params to set to the constructors 4347 }, 4348 params 4349 ); 4350 var ctorOptions = _.extend( 4351 { 4352 id : name, 4353 dom_ready : params.ready || [] 4354 }, 4355 params.options 4356 ); 4357 4358 try { czrapp[ name ] = new params.ctor( ctorOptions ); } 4359 catch( er ) { 4360 czrapp.errorLog( 'Error when loading ' + name + ' | ' + er ); 4361 } 4362 }); 4363 $(function () { 4364 _.each( newMap, function( params, name ) { 4365 if ( czrapp[ name ] && czrapp[ name ].isReady && 'resolved' == czrapp[ name ].isReady.state() ) 4366 return; 4367 if ( _.isObject( czrapp[ name ] ) && _.isFunction( czrapp[ name ].ready ) ) { 4368 czrapp[ name ].ready(); 4369 } 4370 }); 4371 czrapp.status = czrapp.status || 'OK'; 4372 if ( _.isArray( czrapp.status ) ) { 4373 _.each( czrapp.status, function( error ) { 4374 czrapp.errorLog( error ); 4375 }); 4376 } 4377 czrapp.trigger( isInitial ? 'czrapp-ready' : 'czrapp-updated' ); 4378 }); 4379 };//_instantianteAndFireOnDomReady() 4380 czrapp.appMap = new czrapp.Value( {} ); 4381 czrapp.appMap.bind( _instantianteAndFireOnDomReady );//<=THE MAP IS LISTENED TO HERE 4382 czrapp.customMap = new czrapp.Value( {} ); 4383 czrapp.customMap.bind( _instantianteAndFireOnDomReady );//<=THE CUSTOM MAP IS LISTENED TO HERE 4384 4385 4386})( czrapp, jQuery, _ );var czrapp = czrapp || {}; 4387( function ( czrapp, $, _ ) { 4388 czrapp.localized = HUParams || {}; 4389 var appMap = { 4390 base : { 4391 ctor : czrapp.Base, 4392 ready : [ 4393 'cacheProp' 4394 ] 4395 }, 4396 browserDetect : { 4397 ctor : czrapp.Base.extend( czrapp.methods.BrowserDetect ), 4398 ready : [ 'addBrowserClassToBody' ] 4399 }, 4400 jqPlugins : { 4401 ctor : czrapp.Base.extend( czrapp.methods.JQPlugins ), 4402 ready : [ 4403 'imgSmartLoad', 4404 'extLinks', 4405 'parallax' 4406 ] 4407 }, 4408 userXP : { 4409 ctor : czrapp.Base.extend( czrapp.methods.UserXP ), 4410 ready : [ 4411 'setupUIListeners',//<=setup observables values used in various UX modules 4412 'fittext', 4413 'stickify', 4414 'outline', 4415 'smoothScroll', 4416 'headerSearchToLife', 4417 'scrollToTop', 4418 'widgetTabs', 4419 'commentTabs', 4420 'tableStyle', 4421 'sidebarToLife', 4422 'dropdownMenu', 4423 'mobileMenu', 4424 'topNavToLife', 4425 'gutenbergAlignfull', 4426 'mayBePrintWelcomeNote' 4427 ] 4428 } 4429 };//map 4430 czrapp.appMap( appMap , true );//true for isInitial map 4431 4432})( czrapp, 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.