PageSourceSearch

https://tedxathens.com/wp-content/litespeed/js/51c3159820cb8053530e5db07f486805.js?ver=65b79

js tedxathens.com collected 2026-10-02 02:56:45 UTC 10,172 bytes, 85 lines download raw bytes

1/**
2 * Creates and initialises the equal heights elements. 
3 * 
4 * @class
5 * @extends   Responsiville.Debug
6 * @extends   Responsiville.Events
7 * 
8 * @author    Nevma, [email protected]
9 * @license   http://www.gnu.org/licenses/gpl-3.0.en.html GPLv3
10 * 
11 * @fires     Responsiville.Equalheights#init
12 * 
13 * @classdesc A utility class that takes a set of elements and gives them all
14 *            the same height, ie the height of the tallest of them. It is 
15 *            responsive and allows for grouping the elements in rows. It can 
16 *            run in an automatic way so that it groups elements in the same 
17 *            way that they naturally flow in rows as they are being rendered by
18 *            the browser.
19 *
20 * @param {Object} options The initialisation options of the module.
21 * 
22 * @property {boolean} options.debug       Whether to print debug messages in
23 *                                         the  browser console.
24 * @property {boolean} options.slug        A special codename for the instance
25 *                                         of the element, to be used as a class
26 *                                         on its container and as a key in
27 *                                         arrays where it is grouped with other
28 *                                         elements of its kind. 
29 * @property {string}  options.container   The parent element under which the 
30 *                                         elements will be found. If null then 
31 *                                         the direct parent of the elements
32 *                                         will be taken into account.
33 * @property {string}  options.elements    The element that contains the
34 *                                         elements which will eventually take
35 *                                         up the same  height. If left null
36 *                                         then the direct elements if the
37 *                                         parent will be taken into account.
38 * @property {string}  options.children    Sometimes it's not the actual
39 *                                         elements themselves that we want to
40 *                                         make equal height but some other
41 *                                         elements inside them, so that we can
42 *                                         have consistent rows of of content.
43 *                                         This option is a selector that
44 *                                         defines which children inside the
45 *                                         specified elements should become
46 *                                         equal height.
47 * @property {string}  options.resize      Whether to also run on window resize,
48 *                                         as well as each breakpoint change. Of
49 *                                         course, throttled.
50 * @property {string}  options.checkImages Whether to check for images inside
51 *                                         the elements that are going to get
52 *                                         equal heights and run when the images
53 *                                         have all been loaded and all element
54 *                                         heights have been finalised.
55 * @property {string}  options.enter       Comma separated list of breakpoints
56 *                                         in which the module enters, wihch
57 *                                         means it is enabled.
58 * @property {string}  options.leave       Comma separated list of breakpoints
59 *                                         in which the module leaves, which
60 *                                         means it is disabled.
61 */
62Responsiville.Equalheights=function(options){if(!Responsiville.Main.getInstance()){throw new Error('Responsiville instantiation error: the framework has not been initialised, call new Responsiville::Main() and then Responsiville::init().')}
63this.options=jQuery.extend(this.options,Responsiville.Equalheights.defaults,options);this.codeName='responsiville.equalheights';this.responsiville=Responsiville.Main.getInstance();this.imagesLoaded=0;this.$body=this.responsiville.$body;this.$document=this.responsiville.$document;this.$window=this.responsiville.$window;this.$container=jQuery(this.options.container);for(var key in this.options){var value=this.$container.data('responsiville-equalheights-'+key);if(typeof value!=='undefined'){this.options[key]=value}}
64if(this.options.slug==''){Responsiville.Equalheights.elementsCounter=Responsiville.Equalheights.elementsCounter!==undefined?++Responsiville.Equalheights.elementsCounter:0;this.options.slug=this.codeName.replace('.','-')+'-'+Responsiville.Equalheights.elementsCounter}
65var htmlBreakpoints=Responsiville.determineEnableDisableBreakpoints({enter:this.$container.data('responsiville-equalheights-enter'),leave:this.$container.data('responsiville-equalheights-leave')});if(htmlBreakpoints!==null){this.options.enter=htmlBreakpoints.enter;this.options.leave=htmlBreakpoints.leave}
66if(options.elements===undefined){this.$elements=this.$container.find(this.options.elements);if(this.$elements.length===0){this.$elements=this.$container.children()}}else{this.$elements=this.$container.find(this.options.elements)}
67if(this.$elements.length===0){this.log('Responsiville.Equalheights instantiation error: no elements found ('+this.options.elements+').');return}
68this.$container.data('responsiville-api',this);this.$container.data('responsiville-equalheights-api',this);this.$container.addClass(this.options.slug);this.$images=[];this.enabled=!1;this.setupEvents();this.log('equalheights initialised');this.fireEvent('init')};Responsiville.extend(Responsiville.Equalheights,Responsiville.Debug.Extensions);Responsiville.extend(Responsiville.Equalheights,Responsiville.Events);Responsiville.Equalheights.AUTO_RUN=typeof RESPONSIVILLE_AUTO_INIT!=='undefined'?RESPONSIVILLE_AUTO_INIT:!0;Responsiville.Equalheights.defaults={debug:!1,slug:'',container:'.responsiville-equalheights',elements:'.responsiville-equalheights-element',children:null,resize:!0,checkImages:!0,enter
68:'small, mobile, tablet, laptop, desktop, large, xlarge',leave:''};Responsiville.Equalheights.autoRun=function(){jQuery(Responsiville.Equalheights.defaults.container).each(function(){new Responsiville.Equalheights({debug:Responsiville.Main.getInstance().options.debug,container:this})})};Responsiville.Equalheights.prototype.setupEvents=function(){var k,length;var breakpointsEnter=Responsiville.splitAndTrim(this.options.enter);for(k=0,length=breakpointsEnter.length;k<length;k++){this.responsiville.on('enter.'+breakpointsEnter[k],this.getBoundFunction(this.enable))}
69var breakpointsLeave=Responsiville.splitAndTrim(this.options.leave);for(k=0,length=breakpointsLeave.length;k<length;k++){this.responsiville.on('enter.'+breakpointsLeave[k],this.getBoundFunction(this.disable))}
70if(this.responsiville.is(this.options.enter)){this.enable()}};Responsiville.Equalheights.prototype.enable=function(){this.log('enable equalheights');if(!this.enabled){this.responsiville.on('change',this.getBoundFunction(this.runElements));if(this.options.resize){this.responsiville.on('resize',this.getBoundFunction(this.runElements))}
71this.runElements();this.enabled=!0;if(this.options.checkImages){this.$images=this.$elements.find('img');var images=[];for(k=0,length=this.$images.length;k<length;k++){var image=this.$images.eq(k).attr('src');images.push(image);if(Responsiville.hasImageLoaded(image)){this.imagesLoaded++}}
72Responsiville.onImagesLoaded(images,{single:this.getBoundFunction(this.imageLoaded)})}}
73this.fireEvent('enabled')};Responsiville.Equalheights.prototype.disable=function(){this.log('disable equalheights');if(this.enabled){this.responsiville.off('change',this.getBoundFunction(this.runElements));if(this.options.resize){this.responsiville.off('resize',this.getBoundFunction(this.runElements))}
74if(this.options.children){this.$elements.find(this.options.children).css('height','auto')}else{this.$elements.css('height','auto')}
75this.enabled=!1}
76this.fireEvent('disabled')};Responsiville.Equalheights.prototype.imageLoaded=function(event){this.imagesLoaded++;if(this.imagesLoaded==this.$images.length){this.runElements()}
77this.fireEvent('image.loaded',[event])};Responsiville.Equalheights.prototype.imageError=function(event){this.imagesLoaded++;if(this.imagesLoaded==this.$images.length){this.runElements()}
78this.fireEvent('image.error',[event])};Responsiville.Equalheights.prototype.equalise=function($elements){var k=0;var m=0;var height=0;var maxHeight=0;var $element=null;if(this.options.children){var childrenSelectors=Responsiville.splitAndTrim(this.options.children);var childrenSelector=null;for(m=0,length=childrenSelectors.length;m<length;m++){childrenSelector=childrenSelectors[m];maxHeight=0;for(k=0,length=$elements.length;k<length;k++){$element=$elements.eq(k).find(childrenSelector);$element.css('height','auto');height=$element.outerHeight();maxHeight=height>maxHeight?height:maxHeight}
79$elements.find(childrenSelector).css('height',maxHeight+'px')}}else{for(k=0,length=$elements.length;k<length;k++){$element=$elements.eq(k);$element.css('height','auto');height=$element.outerHeight();maxHeight=height>maxHeight?height:maxHeight}
80$elements.css('height',maxHeight+'px')}};Responsiville.Equalheights.prototype.runElements=function(){this.log('equalising heights');this.fireEvent('running.elements');var k=0;var $elements=this.$elements;while($elements.length>0){var $row=jQuery();while($elements.length>0){var $currentElement=$elements.eq(0);if(!$currentElement.is(':visible')){$elements=$elements.slice(1);continue}
81if($row.length==0){$row=$row.add($currentElement);$elements=$elements.slice(1);continue}
82var currentElementRect=$currentElement.get(0).getBoundingClientRect();var previousElementRect=$row.eq($row.length-1).get(0).getBoundingClientRect();var isChangingRow=Math.round(currentElementRect.left)<Math.round(previousElementRect.right);if(isChangingRow){break}else{$row=$row.add($currentElement);$elements=$elements.slice(1);continue}}
83this.equalise($row)}
84this.fireEvent('run.elements')}
85;

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.