PageSourceSearch

https://mveahoa.com/wp-content/themes/hueman/assets/front/js/scripts.js?ver=1790239970

js mveahoa.com collected 2026-09-24 14:48:27 UTC 187,231 bytes, 4,085 lines download raw bytes

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