PageSourceSearch

https://maxderbes.com/wp-content/themes/max-derbes/js/main.js

js maxderbes.com collected 2026-09-28 14:23:00 UTC 5,178 bytes, 186 lines download raw bytes

1var
2  w = window
3  , d = document
4  , e = d.documentElement
5  , g = d.getElementsByTagName('body')[0]
6  , x = w.innerWidth||e.clientWidth||g.clientWidth
7  , y = w.innerHeight||e.clientHeight||g.clientHeight
8  , fs = parseFloat(w.getComputedStyle(g, null).getPropertyValue('font-size'))
9  , xem = x/fs
10  , yem = y/fs
11  ;
12
13var waitForFinalEvent = (function () {
14  var timers = {};
15  return function (callback, ms, uniqueId) {
16    if (!uniqueId) {
17      uniqueId = "Don't call this twice without a uniqueId";
18    }
19    if (timers[uniqueId]) {
20      clearTimeout (timers[uniqueId]);
21    }
22    timers[uniqueId] = setTimeout(callback, ms);
23  };
24})();
25
26
27jQuery.fn.setAllToMaxHeight = function() {
28  return this.height( Math.max.apply(this, jQuery.map( this , function(e){ return jQuery(e).height() }) ) );
29}
30
31jQuery(document).ready(function($) {
32  var $featProperties = $('.bxslider-properties');
33  var slide_margin = 10
34    , slide_width = $('.bxslider-properties').width()
35    , properties_minSlides = 1
36    , properties_pager = true
37    , properties_controls = false
38  ;
39
40  if ( xem > 40 ) {
41    slide_width = slide_width / 2;
42    properties_minSlides = 2;
43    properties_pager = true
44    properties_controls = false;
45  }
46
47  if ( xem > 60 ) {
48    properties_pager = false;
49    properties_controls = true;
50    slide_margin = 25;
51    slide_width = 315;
52    properties_minSlides = 3;
53  }
54
55
56  // Initialize properties slider and store in variable for later usage
57  var $propertiesSlider = $featProperties.bxSlider({
58    minSlides: properties_minSlides
59    , maxSlides: properties_minSlides
60    , slideWidth: ( slide_width - slide_margin )
61    , slideMargin: slide_margin
62    , pager: properties_pager
63    , controls: properties_controls
64    , moveSlides: 1
65    , adaptiveHeight: true
66    , onSliderLoad : function( currentIndex ) {
67      // Add slideMargin to last slide (to account for the red banners)
68      $('.featured-properties-container').find('.bx-wrapper').css({ 'max-width' : '+=' + slide_margin + 'px' });
69    }
70  });
71
72  // On load
73  $(window).load(function() {    
74    var div = $('.property-photo');
75    var img = div.find('img');
76
77    var b = div.height();
78    var y = img.height();
79
80    if ( y > b )
81    {
82      var h = ( b - y ) / 2;
83      if ( h < 0 )
84      {
85        img.css({'top' : h});
86      }
87    }
88
89    $('.menu-button').click(function(event) {
90      event.preventDefault();
91      $('.main-nav-items').slideToggle();
92    });
93
94
95    var main_slideshow_slides = $('.bxslider').find('li').length;
96    $('.bxslider').find('li').each(function(index){
97      if ( index >= 0 ) {
98        var img_src = $( this ).data( 'img-src' );
99        var img = $('<img class="parallax-window"  src="' + decodeURIComponent( img_src ) + '" />');
100        $( this ).append( img );
101      }
102      if ( index === ( main_slideshow_slides - 1 ) ) {
103        $('.bxslider').bxSlider({
104          mode: 'fade'
105          , auto: true
106          , pager: false
107        });
108      }
109    });
110
111
112    $( '.js-noclick > a' ).click( function( event ) {
113      event.preventDefault();
114      if ( xem < 60 ) {
115        $( this ).next( '.sub-menu' ).slideToggle();
116      }
117    });
118  });
119
120  // On window resize 
121  $(window).resize(function() {
122    var
123    w = window
124    , d = document
125    , e = d.documentElement
126    , g = d.getElementsByTagName('body')[0]
127    , x2 = w.innerWidth||e.clientWidth||g.clientWidth
128    , y = w.innerHeight||e.clientHeight||g.clientHeight
129    , fs = parseFloat(w.getComputedStyle(g, null).getPropertyValue('font-size'))
130    , xem = x2/fs
131    , yem = y/fs
132    ;
133
134    // Do nothing if browser width is same after resize
135    if (x === x2) return;
136
137    // Do nothing if the width is larger or equal to the slider
138    if (x2 >= 1080) return;
139    
140    // Set new browser width
141    x = x2;
142
143    // Destroy the current slider
144    waitForFinalEvent(function() {$propertiesSlider.destroySlider()}, 100, 'dfa_destroy_slider');
145    
146    // Re-initialize the slider
147    waitForFinalEvent(function() {      
148      var slide_margin = 10
149        , slide_width = $('.bxslider-properties').width()
150        , properties_minSlides = 1
151        , properties_pager = true
152        , properties_controls = false
153      ;
154
155      if ( xem > 40 ) {
156        slide_width = slide_width / 2;
157        properties_minSlides = 2;
158        properties_pager = true
159        properties_controls = false;
160      }
161
162      if ( xem > 60 ) {
163        properties_pager = false;
164        properties_controls = true;
165        slide_margin = 25;
166        slide_width = 315;
167        properties_minSlides = 3;
168      }
169      
170      $featProperties.bxSlider({
171      minSlides: properties_minSlides
172      , maxSlides: properties_minSlides
173      , slideWidth: ( slide_width - slide_margin )
174      , slideMargin: slide_margin
175      , pager: properties_pager
176      , controls: properties_controls
177      , moveSlides: 1
178      , adaptiveHeight: true
179      , onSliderLoad : function( currentIndex )
180      {
181        // Add slideMargin to last slide (to account for the red banners)
182        $('.featured-properties-container').find('.bx-wrapper').css({ 'max-width' : '+=' + slide_margin + 'px' });
183      }
184    })}, 300, 'dfa_rebuild_slider');
185  });
186});

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.